I wrote up these directions (based on directions @ http://www.hksilver.net/rsync/ on a couple weeks ago when I was doing some work with rsync. Someday I’m sure I’ll need them again… and maybe someone else will benefit. So here goes nothing:
Download this zip file (which contains cygwin1.dll,instsrv.exe,rsync.exe and srvany.exe) (I mirrored it here)
Decompress the contents to c:\rsync.
Copy out cygwin1.dll to c:\(system folder)\system32, where system folder is either winnt or windows depending upon your OS.
Open a command prompt and type:
cd c:\rsync
instsrv Rsync “c:\rsync\srvany.exe”
exit
Click on Start, run, and type in regedit.
Once you’re in the Registry Editor, make the following changes (Quotes ARE important!):
HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services -> Rsync
Right click on Rsync, New -> Key Key Name: Parameters
Right click on Parameters New -> String Value
Value Name: AppDirectory
Value: “c:\rsync”
Right click on Parameters New -> String Value
Value Name: Application
Value: “c:\rsync\rsync.exe”
Right click on Parameters New -> String Value
Value Name: AppParameters
Value: –config=”c:\rsync\rsyncd.conf” –daemon
Close the Registry Editor.
SOURCE MACHINE
******************************************************
If this is the source machine (ie: a machine you’d like other machines to copy/sync with), open up c:\rsync\rsyncd.conf in notepad and modify the rsync share setting giving it a well-known, descriptive name. Modify the path to point to a directory that you want to make available for others to get access too. Save and close rsyncd.conf.
Open up Administrative Tools either off the Start Menu or in Control Panel. Double click Services. Scroll down the list to Rsync. Highlight it and start the service.
To test it, open up a command prompt and type:
telnet localhost 873
If you get a connection, rsync was installed successfully. Congratulations!
DESTINATION MACHINE
******************************************************
If this is a machine you’d like to have copy/sync with a remote host, then bring up a command line and type:
cd c:\rsync
rsync -rt –progress –delete [INSERT HOST]::[INSERT SHARE] [INSERT DESTINATION PATH]
exit
For example, if I had a staging server located at ip address 10.10.1.162 with a share called “staging.cephas.net” that I wanted to sync with, I’d type something like this:
rsync -rt –progress –delete 10.10.1.162::staging.cephas.net f:/fInetPub/hosts/live.cephas.net/wwwroot/images/
where 10.10.1.162 is my staging server, staging.cephas.net is the rsync share, and f:/fInetPub/hosts/live.cephas.net/wwwroot/images/ is the destination that I want to be synced up. Note that if you don’t want files deleted from destination that have been deleted in the source, you should remove the –delete option.
If you’d like run through a sync as a test, add the -n flag like this:
rsync -rtn –progress –delete 10.10.1.162::staging.cephas.net f:/fInetPub/hosts/live.cephas.net/wwwroot/images/
Rsync will list out the files that it *would* have copied/deleted.
The synchronization can (and probably should) be run as a scheduled task using Windows Task Scheduler. To do this, create a .bat file, add the following text (substituting your source, share, and destinations):
cd c:\rsync
rsync -rt –progress –delete 10.10.1.162::staging.cephas.net f:/finetpub/hosts/live.cephas.net/wwwroot/images/
and then use the Windows Scheduler (Start –> Programs –> Accessories –> System Tools –> Scheduled Tasks) to create a task that fires every n (minutes? hours?) per day.
Questions or problems? Email me.