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.
You’re directions to setup rsync are great! I’m having a little problem with the rsync server though. I’ve got a w2k server running the rsync service. I was able to sync with the rsync server without difficulty until I re-booted the W2k box. Now, I see that the rsync service is no longer listening on port 873. Any ideas would be immensely appreciated! Thank you in advance.
Ryan Christensen
hey Ryan,
Couple things you can check on:
a) make sure that after restarting the box that the registry changes you made are still there… I’m completely guessing that maybe your sysadmin has a policy that doesn’t allow registry changes or something. start –> run — regedit –> browse to the
HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services -> Rsync
key. Still there? then….
b) find out if the service is throwing errors at startup, you can check the Event Viewer to see if something is off…
c) is it possible that you installed it while logged in a user A and then rebooted and logged in as user B? maybe user B doesn’t have permissions to run the service?
d) make sure that the Rsync service is set to startup Automatically (start –> settings –> control panel –> administrative tools –> services –> scroll to the rsync service… right click for properties)
That’s all I can think of!
Hope that helps!
AJ
hi,
can u give me directions to implement this actual rsync algo in JAVA.. we need to do this as a part of our project…any help will be appreciated…thanks in anticipation
Hi,
I found it really a good site for rsync setup.But I am facing one problem while setting up,I am not getting what name I need to provide for rsync share in the host machine Example rsync -rt –progress 172.76.16.2::rsync share c:\testbeds .Could any one of you help me in this regard.(What name I need to provide in rsync share place)
Thanks in advance
Regards
Roopa
Hi Roopa,
For rsync setup rsync -rt –progress 172.76.16.2::rsync share c:\testbeds
rsync share should be your destination server port #
– Aaron Johnson