Wednesday 17 March 2010

Rsync over ssh hanging / freezing in Cygwin problem

Sometimes when using rsync over ssh under cygwin in windows to synchronise files from one server to another, the rsync process copies a few files and then just hangs. Sometimes the rsync process utilises 100% cpu and sometimes 0% cpu, but in either case no more files are synchronised.

The solutions is to use rsync as a daemon on the remote server.

run the following in cygwin on the remote windows machine.

cygrunsrv --install "rsyncd" --path /usr/bin/rsync --args "--daemon --no-detach" --desc "Starts a rsync daemon for accepting incoming rsync connections" --disp "Rsync Daemon" --type auto

then create the following file /etc/rsyncd.conf

In this file you should have something like:

max connections = 10
log file = /var/log/rsync.log
timeout = 300
[pub]
comment = Random things available for download
path = /path/to/my/public/share
read only = no
list = yes
Note: in the above example the name of the module is pub.

Then start the service. You can use "net start rsyncd" to do this.

Now when you want to rsync use:

rsync ... src rsync://user@host/pub/datafolder

notice that you must use modules when using rsync daemon. In this case the module is pub.

The above rsync will copy the files to /path/to/my/public/share/datafolder

No comments:

Post a Comment