This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Miscellaneous » Setting up rsync with a Windows computer
Setting up rsync with a Windows computer [message #32052] Mon, 23 July 2007 17:52 Go to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
Hello all,

I'm trying to get rsync to work, but so far, the command prompt gives the following:

>> exec rsync --progress --dry-run -azC...host.com:/usr/home/user/myproject/

.. and nothing seems to be happening.

I'm using Windows XP (technically, it's on a Mac machine running via Parallels). I installed cwRsync, and put its bin/ directory in my environment variables path.

My host supports SSH, and I usually use PuTTy to access my host's server via SSH.

What programs do I need running while performing rsync?

What do I need to do on the server-side to perform rsync?

And do I need another configuration file besides the properties.ini file used by symfony?

Thanks for all your help, in advance!
Re: Setting up rsync with a Windows computer [message #32383 is a reply to message #32052 ] Fri, 27 July 2007 11:54 Go to previous messageGo to next message
chrilleh  is currently offline chrilleh
Messages: 21
Registered: March 2006
Junior Member
I have the exact same problem...
Re: Setting up rsync with a Windows computer [message #32417 is a reply to message #32383 ] Fri, 27 July 2007 20:37 Go to previous messageGo to next message
mlier  is currently offline mlier
Messages: 101
Registered: May 2006
Senior Member
The exact same problem... (symfony 1.0.5)

Symfony is blocked in the following function. It cannot execute the php passthru function. Do not know why ! It starts but does not finish.

C:\php\PEAR\symfony\vendor\pake\pakeFunction.php
function pake_sh($cmd)
{
  $verbose = pakeApp::get_instance()->get_verbose();
  pake_echo_action('exec ', $cmd);

  ob_start();
  passthru($cmd.' 2>&1', $return);
  $content = ob_get_contents();
  ob_end_clean();

  if ($return > 0)
  {
    throw new pakeException(sprintf('Problem executing command %s', $verbose ? "\n".$content : ''));
  }

  return $content;
}



Re: Setting up rsync with a Windows computer [message #32418 is a reply to message #32417 ] Fri, 27 July 2007 21:20 Go to previous messageGo to next message
mlier  is currently offline mlier
Messages: 101
Registered: May 2006
Senior Member
the passthru function works well. I tried :

php -r "passthru('rsync 2>&1');"

It responds well. So rsync works well too.

The rsync command generated by symfony works well too. I tried it directly in a msdos command.

So what is the problem ? I do not know ? Some times in the life you have no response, that is not a problem. Life is still nice.
Re: Setting up rsync with a Windows computer [message #32426 is a reply to message #32418 ] Sat, 28 July 2007 08:50 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
Out of interest, which PHP version are you running?

I'm running 5.2.3, and I'm beginning to suspect that the problem is with the PHP installation..
Re: Setting up rsync with a Windows computer [message #32439 is a reply to message #32052 ] Sat, 28 July 2007 12:58 Go to previous messageGo to next message
chrilleh  is currently offline chrilleh
Messages: 21
Registered: March 2006
Junior Member
5.2.3 here too.
Re: Setting up rsync with a Windows computer [message #32457 is a reply to message #32439 ] Sun, 29 July 2007 08:24 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
mlier,

Thanks for the inspiration. I managed to use the function you pointed out to get the full command being generated by symfony, and used it directly on the command line.

It just asks for a password then works normally..

I don't know what additional benefits running the script through symfony offers, but as long as it works, I'm happy Very Happy
Re: Setting up rsync with a Windows computer [message #32465 is a reply to message #32052 ] Sun, 29 July 2007 14:47 Go to previous messageGo to next message
chrilleh  is currently offline chrilleh
Messages: 21
Registered: March 2006
Junior Member
I also got it working by executing the rsync command manually from the command line. But is this a bug or what?
icon8.gif  Re: Setting up rsync with a Windows computer [message #32480 is a reply to message #32052 ] Sun, 29 July 2007 22:23 Go to previous messageGo to next message
whatever1998  is currently offline whatever1998
Messages: 3
Registered: July 2007
Junior Member
Hello guys,

i'M having the exact same problem. Can you PLEASE decribe exactly what you did 'cause I spent 5-6 hours on this today and I still don't know what to do ...

My Specs local:
windows XP
symfony 1.0.5
I configured the "properties.ini" file like this:
[symfony]
name=(my app name)

[production]
host=mydomaine.com
port=7822
user=myusernamer
dir=/home/myusername/myapp/

It's on a2hosting.com

DO I need putty running as a tunnel ? If so, how do I need to config it ?

I emailed a2hosting and their answer was pure solid crap.

Please help !

Thank you.
Re: Setting up rsync with a Windows computer [message #32482 is a reply to message #32480 ] Sun, 29 July 2007 23:32 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
whatever1998,

I managed to get rsync to work, but without using it from symfony (technically, I now have a file permission issue, but that's another story I'm dealing with).

What I did was, I went to the pakeFunction.php file (as mlier pointed out), in C:\php\PEAR\symfony\vendor\pake\pakeFunction.php (or something similar on your computer).

I modified the following part of the script, as below:

function pake_sh($cmd)
{
  $verbose = pakeApp::get_instance()->get_verbose();
  pake_echo_action('exec ', $cmd);

// added the following line to display the full rsync command:
echo $cmd;

/*
// commented this part so that the Command Line doesn't freeze up
  ob_start();
  passthru($cmd.' 2>&1', $return);
  $content = ob_get_contents();
  ob_end_clean();
*/  

if ($return > 0)
  {
    throw new pakeException(sprintf('Problem executing command %s', $verbose ? "\n".$content : ''));
  }

  return $content;
}

Now, when you type the sync command

symfony sync production go

You will get the complete rsync command. Copy that (right-click -> Mark. Then highlight the command, and press Enter). You can paste it to a text editor and make sure it's on a single line (no line breaks).

Paste it back to the command line, and press Enter. You should get a message that the RSA isn't recognized, or something like that. Choose 'Yes'.

You will be asked for your password (to access the server via SSH). Enter your password, and rsync should start up.

If I lost you in any of the steps, please say so, and I'll add some extra info in there.

I hope your problem and solution are the same as mine, so my experience can be of benefit to you. Smile
Re: Setting up rsync with a Windows computer [message #32530 is a reply to message #32052 ] Mon, 30 July 2007 15:22 Go to previous messageGo to next message
whatever1998  is currently offline whatever1998
Messages: 3
Registered: July 2007
Junior Member
The description was MORE than perfect.

THank you very very much for your time and answer !

for future references, I get this error doing the rsync command manually:
Could not create directory '/cygdrive/c/(My desktop)/.ssh'

that's probably the error... I googled it but couldn't find anything.. Anyway.


THanks again SOOOO much for this !
Re: Setting up rsync with a Windows computer [message #32543 is a reply to message #32530 ] Mon, 30 July 2007 17:27 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
I'm glad I could help Smile
Re: Setting up rsync with a Windows computer [message #32583 is a reply to message #32543 ] Tue, 31 July 2007 10:03 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
Im having a bit of trouble with this rsync thingie.
Your advice was of great support, but i do not see how to fix it.

this is what symfony sync production go does->
rsync --progress  -azC --force .../home/topdown/symfony/jobrsync
rsync --progress  -azC --force --delete --exclude-from=config/rsync_exclude.txt
-e "ssh -p22" ./ topdown@top-download.net:/home/topdown/symfony/jobrsync


when running the first line manually i get->
rsync -r /cygdrive/c/wamp/www/jobV2/ topdown@top-download.net:/home/topdown/symfony/jobrsync
 No such file or directory (2)


when changing that to->
rsync --progress  -azC --force topdown@top-download.net:/home/topdown/symfony/jobrsync


it works,
however in the mailing list other people seem to have no problems, how can i fix symfony sync?
Re: Setting up rsync with a Windows computer [message #32653 is a reply to message #32426 ] Wed, 01 August 2007 09:23 Go to previous messageGo to next message
mlier  is currently offline mlier
Messages: 101
Registered: May 2006
Senior Member
I use PHP 5.2.3 (cli) (built: May 31 2007 09:37:22)
Problem with rsync and propel-load-data with php 5.2.3 and symfony 1.0.5 [message #32710 is a reply to message #32052 ] Wed, 01 August 2007 18:18 Go to previous messageGo to next message
mlier  is currently offline mlier
Messages: 101
Registered: May 2006
Senior Member
An another clue about that problem.

There is the same kind of problem in symfony with the command : propel-load-data.

It doesn't work on a PC with php 5.2.3.
It works well on a PC with php 5.1.6.

Any idea from the core team ?
Re: Setting up rsync with a Windows computer [message #32898 is a reply to message #32052 ] Mon, 06 August 2007 10:47 Go to previous messageGo to next message
tamcy  is currently offline tamcy
Messages: 222
Registered: February 2006
Location: Hong Kong
Faithful Member
I found symfony sync "freezes" after upgrading to PHP5.2.3 on my Windows box. No problem in PHP5.2.1 (never tried PHP5.2.2).

Seems PHP5.2.3 doesn't print output and accepts input from the device as it was in PHP 5.2.1, but I'm not very sure...
Re: Setting up rsync with a Windows computer [message #33269 is a reply to message #32898 ] Mon, 13 August 2007 10:08 Go to previous messageGo to next message
tamcy  is currently offline tamcy
Messages: 222
Registered: February 2006
Location: Hong Kong
Faithful Member
for windows user running PHP5.2.3 or above,
  echo pake_sh($cmd);


to

  echo pake_sh('start '.$cmd);


Cons: it opens a new window which closes immediately after finish, so you can't check the log.
Re: Setting up rsync with a Windows computer [message #35862 is a reply to message #32052 ] Tue, 18 September 2007 14:58 Go to previous messageGo to next message
Raise  is currently offline Raise
Messages: 20
Registered: August 2006
Location: UK
Junior Member
Has anyone managed to get to the bottom of this problem? I'm having exactly the same problem as described here (PHP 5.2.4, cwRsync). Orkestra's workaround by editing the pakeFunction class does work but is a little clumsy... hopefully this is something that can be remedied in symfony?

Worth opening a ticket, or is it something obvious?
Re: Setting up rsync with a Windows computer [message #35880 is a reply to message #35862 ] Tue, 18 September 2007 17:04 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
fix would be nice

[Updated on: Tue, 18 September 2007 17:04]

Re: Setting up rsync with a Windows computer [message #36149 is a reply to message #35880 ] Sun, 23 September 2007 21:40 Go to previous messageGo to next message
Valere  is currently offline Valere
Messages: 13
Registered: September 2007
Location: Bussy Saint Georges, FR
Junior Member
Hello,

Can someone fix it ?
Re: Setting up rsync with a Windows computer [message #36150 is a reply to message #36149 ] Sun, 23 September 2007 21:59 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
there is something in the wiki, not sure it helps.
Re: Setting up rsync with a Windows computer [message #36151 is a reply to message #36150 ] Sun, 23 September 2007 22:03 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
it seems to:
http://trac.symfony-project.com/trac/wiki/SymfonySyncOnWindo ws

didn't have time to try it yet, app i was working on didn't have production yet Smile, but it does more than without those files Smile and just cgwin

[Updated on: Sun, 23 September 2007 22:04]

Re: Setting up rsync with a Windows computer [message #36152 is a reply to message #36151 ] Sun, 23 September 2007 22:12 Go to previous messageGo to next message
Raise  is currently offline Raise
Messages: 20
Registered: August 2006
Location: UK
Junior Member
The rsync files offered in the Wiki are useful, but they are not part of the solution to this problem - the problem occurs *after* installation of rsync, and is to do with how symfony invokes rsync.

The rsync command generated by symfony is fine (using Orkestra's workaround and copying and pasting it back to the command prompt proves this), the problem is with how symfony and rysnc co-operate.

I can't see without some more research what the problem is, though it seems like it is something such as the prompts from rsync (for password, etc) required by ssh that are not being bubbled up to symfony's pake command so they can responded to by the user. This is just a guess though.
Re: Setting up rsync with a Windows computer [message #38029 is a reply to message #32052 ] Wed, 24 October 2007 12:33 Go to previous messageGo to next message
flat stanley  is currently offline flat stanley
Messages: 46
Registered: November 2006
Location: London
Member
The problem definately seems to be with the passthru() command.

mlier....

Quote:

the passthru function works well. I tried :

php -r "passthru('rsync 2>&1');"


It responds well. So rsync works well too.


This is correct but if you get the full rsync command using Orkestra's workaround and try using passthru with this, then it hangs (in exactly the same way as when you use the symfony sync command).

I tried changing passthru to exec, but it still hangs.


Antique Silver, Hester Bateman Silver, Collecting Silver
Re: Setting up rsync with a Windows computer [message #38030 is a reply to message #38029 ] Wed, 24 October 2007 12:51 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
flat_stanley,

Did you try tamcy's solution (i.e. changing the argument parameter of the pake_sh function)?

This worked for me.
Re: Setting up rsync with a Windows computer [message #38035 is a reply to message #38029 ] Wed, 24 October 2007 13:59 Go to previous messageGo to next message
flat stanley  is currently offline flat stanley
Messages: 46
Registered: November 2006
Location: London
Member
Yes that works! Strange...

This really seems like a bug with php's passthru command.

Its just a shame that you can't see the output, especially during the dry run.

Thanks for the advice


Antique Silver, Hester Bateman Silver, Collecting Silver
Re: Setting up rsync with a Windows computer [message #38627 is a reply to message #38035 ] Fri, 02 November 2007 16:34 Go to previous messageGo to next message
lajkonik86  is currently offline lajkonik86
Messages: 190
Registered: June 2007
Location: The Netherlands
Senior Member
echo pake_sh('start '.$cmd);

is beautiful Smile thanks


for those wondering:
go to pear/data/symfony/tasks/sfPakeEnvironment.php
and near the bottom make the change to:
echo pake_sh('start '.$cmd);
Re: Setting up rsync with a Windows computer [message #39700 is a reply to message #38627 ] Fri, 16 November 2007 21:12 Go to previous messageGo to next message
Wicked  is currently offline Wicked
Messages: 17
Registered: May 2007
Location: Novosibirsk, Rusia
Junior Member

I think this is our case: http://bugs.php.net/bug.php?id=41874
Re: Setting up rsync with a Windows computer [message #40250 is a reply to message #39700 ] Sun, 25 November 2007 16:48 Go to previous messageGo to next message
andrewm  is currently offline andrewm
Messages: 35
Registered: June 2006
Member
The workaround noted above does not work for me in PHP 5.2.4 on my windows dev machine.

Has anyone reported this as a bug? I looked and found nothing.

It looks like the PHP people are not going to 'fix' this. Looks like Pake will have to be modified to deal with proc_open or something else to get around this change.

[Updated on: Sun, 25 November 2007 16:50]

Re: Setting up rsync with a Windows computer [message #40890 is a reply to message #32052 ] Tue, 04 December 2007 22:22 Go to previous messageGo to next message
jtbrne  is currently offline jtbrne
Messages: 2
Registered: September 2007
Junior Member
To keep the window open after the command executes

echo pake_sh('start cmd /k '.$cmd);
Re: Setting up rsync with a Windows computer [message #40902 is a reply to message #40890 ] Wed, 05 December 2007 06:33 Go to previous messageGo to next message
orkestra  is currently offline orkestra
Messages: 65
Registered: May 2007
Location: Kuwait
Member
I'll try this out...

Thanks for posting!
Re: Setting up rsync with a Windows computer [message #57863 is a reply to message #40902 ] Mon, 04 August 2008 22:55 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
Here is how I got it to work with Symfony 1.1.

First, install the rsync software. (See http://trac.symfony-project.org/wiki/SymfonySyncOnWindows)

Second, you need to be able to 'ssh' to your host with a public key instead of a password using PuTTY. See http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty. html for details on how to do this.

Once you can use PuTTY to connect to your server using your public key (without a password), then you are ready to make the following change to {myproject}/config/properties.ini

Under the "[production]" key, change "port=22" to "port=22 -i c:\path\to\your\key.ossh". (If you only have a .ppk file, you can convert it to a .ossh file using "puttygen.exe" [MenuBar > Conversions > Export OpenSSH Key]). Also, the key you are using shouldn't have a passphrase so that everything happens without additional user interaction.

[production]
  host=myapp.example.com
  port=22 -i c:\path\to\your\key.ossh
  user=myuser
  dir=/home/myaccount/myproject

Now you are ready to test it (in "dry run" mode no files are actually copied)
symfony project:deploy production

(In sf1.0, the command is "symfony sync production")

To actually update the files you must add the "go" flag.
symfony project:deploy --go production

(In sf1.0, the command is "symfony sync production go")
Re: Setting up rsync with a Windows computer [message #63901 is a reply to message #57863 ] Fri, 24 October 2008 23:30 Go to previous messageGo to next message
anush  is currently offline anush
Messages: 7
Registered: October 2008
Junior Member
thanks robh. your solution worked great for me!
Re: Setting up rsync with a Windows computer [message #68230 is a reply to message #63901 ] Fri, 19 December 2008 18:25 Go to previous messageGo to next message
mlier  is currently offline mlier
Messages: 101
Registered: May 2006
Senior Member
In Symfony 1.2.1

symfony project:deploy ... does not work and stay freezed Twisted Evil Twisted Evil

The problem occur in symfony\task\project\sfProjectDeployTask.class.php

Line 160
$this->log($this->getFilesystem()->sh("rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir"));


This line does not work properly with php 5.2.6

Any idea Confused
Re: Setting up rsync with a Windows computer [message #68880 is a reply to message #68230 ] Tue, 30 December 2008 21:45 Go to previous messageGo to next message
Papy Danone  is currently offline Papy Danone
Messages: 5
Registered: June 2008
Junior Member
I've got the exact same problem with PHP 5.2.6... it just freezes

EDIT: ok I found a fix based on the one that was found for 1.0:

replace line 160 in \lib\task\project\sfProjectDeployTask.class.php by:

$this->log($this->getFilesystem()->sh("start cmd /k rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir"));

[Updated on: Tue, 30 December 2008 21:55]


using version 1.0.16
Re: Setting up rsync with a Windows computer [message #69826 is a reply to message #68880 ] Wed, 14 January 2009 00:22 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
Here is another reason that it might appear to "hang".

The very first time that you ever connect to a host via SSH, it will look up the host in the "known_host" file. This is a security measure done by SSH to prevent you from accidentally connecting to a new server.

If this is the first time you have connected to that server from the command line, the task will get hung up waiting for input.

Try this:

In the Windows command windows, type...

ssh YOUR-DOMAIN-NAME.COM


The first time you will see:

The authenticity of host 'YOUR-DOMAIN_NAME.COM (12.34.56.78)' can't be establish
ed.
RSA key fingerprint is 11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF.
Are you sure you want to continue connecting (yes/no)?


Type 'yes' and press ENTER, then it will ask you for a password.

Now when you run the symfony project:deploy command again, it won't ask that question and everything should work. This assumes that you have used the public-key sign in method previously mentioned.

Re: Setting up rsync with a Windows computer [message #71456 is a reply to message #69826 ] Wed, 04 February 2009 16:40 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Ugh I have been having such trouble with rsync but i definitely need it for my site. I remember using it before and it worked to some extent but it gave me serious permission errors on my remote host. I realized that I probably entered the wrong directory name so I fixed that up today and found that it hung. I used the fix described above (thanks for the help) and I now get this error. Is this a problem with rsync or the path to the remote server? Has anyone has an error like this before?

rsync: -azC...domains/scribnia.com/scribnia2/: unknown option
rsync error: syntax or usage error (code 1) at main.c(1423) [client=3.0.4]


Re: Setting up rsync with a Windows computer [message #71462 is a reply to message #71456 ] Wed, 04 February 2009 17:12 Go to previous messageGo to next message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
I think you need to determine exactly what is being executed by the shell.

Temporarily, add the following code to "symfony/task/project/sfProjectDeploy.php" (just before the "$this->log() call at the end of the file):

echo "rsync --progress $dryRun $parameters -e $ssh ./ $user$host:$dir\n";


Then, execute your "project:deploy" command. After you see what is being executed, then you can try to narrow down the problem. You might be missing a space, or maybe you need to "quote the path with spaces". It should be more obvious once you see what is being executed by the shell.
Re: Setting up rsync with a Windows computer [message #71481 is a reply to message #71462 ] Wed, 04 February 2009 20:56 Go to previous messageGo to next message
Russpd  is currently offline Russpd
Messages: 104
Registered: September 2008
Senior Member
Thanks for the help robh, unfortunately, I had no luck finding that file in symfony 1.0.17. I searched under both the PEAR and data directories and did a search of my wamp directory. Do you know anywhere else it could be or a similar file for symfony 1.0?

Thanks
Re: Setting up rsync with a Windows computer [message #71483 is a reply to message #71481 ] Wed, 04 February 2009 21:15 Go to previous messageGo to previous message
robh  is currently offline robh
Messages: 16
Registered: July 2008
Junior Member
The previous path was for 1.2

In 1.0, look at "data/tasks/sfPakeEnvironment.php". Just add "echo $cmd;" near the end of the file.
Previous Topic:Job Opportunies for Symfony Developers
Next Topic:Looking for sf developers to create a start-up with
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software