BOLLERUD,CHRIS W (HP-MountainView,ex1)
2001-Nov-22 10:23 UTC
How to setup Rsync as an NT Service
For a recent project I needed to run Rsync as a service on Windows NT. The following is a link to the instructions I created to recreate my steps. http://members.home.net/cbollerud2/projects/rsync/NTService.html The "no-fork" patch used here is very similar to the "no-detach" option mentioned in many previous posts. I wish I could take credit for it, but I basically put pieces together from previous posts and web searches. We are pushing about 80,000 files to multiple Rsync servers with about 100M of updates a day. Other than the initial filescan, which takes some time, the updates have been working very well. I've recently tried compiling under the latest version of Cygwin and have been having some trouble. It would appear that Cygwin has changed slightly such that the configure script does not correctly identify all the settings. If anyone has any insight to this please post the solution. Chris Bollerud Software Engineer Hewlett Packard
> To create the install package described here you will need to obtain a copy of the NT Server or Windows 2000 Server Resource Kit. There are many sources for these utilities. Perhaps the easiest is to get the book and CD from any technical bookstore or online at http://www.amazon.com for as low as $35. Search for: > The NT Server 4.0 Resource Kit Supplement 4 > Windows 2000 Server Resource Kit >I suggest to add a paragraph to use "cygrunsrv" instead of "srvany" as any CygWin user can download it easily =) (as in: cygrunsrv -I "rsyncd" -p /usr/bin/rsync -a '--config /etc/rsync.conf --daemon') BTW: whats' wrong in a plain&easy CygWin's precompiled rsync? (I'm interested in comments&suggestions as I'm the mantainer of that package... ^_^) -- Lapo 'Raist' Luchini lapo@lapo.it (PGP & X.509 keys available) http://www.lapo.it (ICQ UIN: 529796)
BOLLERUD,CHRIS W (HP-MountainView,ex1)
2001-Nov-22 11:41 UTC
How to setup Rsync as an NT Service
The pre-compiled version of Rsync does not offer a way to turn off forking in daemon mode. When an NT Service tries to stop or pause a service it uses the same PID that was used to start the program. Because the program forks it creates a new PID and the Service Control Panel is no longer able to stop the Service. Also, if the Service was started under the System account it is not possible to stop the program using End Task. This leaves restarting the computer as the only option to stop the service. (A Microsoft Quirk) By adding the no-fork option, the service works as any other NT Service. If there is another way to do this I would be very interested in learning about it. Thanks for the information on the cygrunsrv program. I was not aware that this was an option. Chris Bollerud -----Original Message----- From: Lapo Luchini [mailto:lapo@lapo.it] Sent: Wednesday, November 21, 2001 4:19 PM To: rsync@lists.samba.org Cc: BOLLERUD,CHRIS W (HP-MountainView,ex1) Subject: Re: How to setup Rsync as an NT Service> To create the install package described here you will need to obtain acopy of the NT Server or Windows 2000 Server Resource Kit. There are many sources for these utilities. Perhaps the easiest is to get the book and CD from any technical bookstore or online at http://www.amazon.com for as low as $35. Search for:> The NT Server 4.0 Resource Kit Supplement 4 > Windows 2000 Server Resource Kit >I suggest to add a paragraph to use "cygrunsrv" instead of "srvany" as any CygWin user can download it easily =) (as in: cygrunsrv -I "rsyncd" -p /usr/bin/rsync -a '--config /etc/rsync.conf --daemon') BTW: whats' wrong in a plain&easy CygWin's precompiled rsync? (I'm interested in comments&suggestions as I'm the mantainer of that package... ^_^) -- Lapo 'Raist' Luchini lapo@lapo.it (PGP & X.509 keys available) http://www.lapo.it (ICQ UIN: 529796)
Here is how: Use the KILL.EXE from the NT Resource kit. On my systems, I use the NT scheduler to run batch files (using the default AT or the GUI WINAT.EXE from the NT resource kit). At the start of each batch file, I use: c:\bin\KILL.EXE rsync This ensure that rsync is not already running! Here is my setup: 1. No need to install cygwin 2. I have FS1 & FS2 to backup on FSX 3. The same client batch file is used (use %COMPTUERNAME%) 4. I backup the client e: drive to the server .bak folders Put into c:\bin of all machines: - rsync.exe - cygwin1.dll - kill.exe - srvany.exe - instsrv.exe Along with these text files (copy everything between the tags): <rsync.bat> SET OPTION=--compress --recursive --times --delete --bwlimit=75 SET SELECT=--exclude "*bak" --exclude "*~" SET SOURCE=/cygdrive/e/ SET SERVER=FSX::%COMPUTERNAME% c:\bin\kill.exe rsync c:\bin\rsync.exe %OPTION% %SELECT% %SOURCE% %SERVER% <EOF> <rsybcd.conf> use chroot = false strict modes = false read only = false [FS1] path = /cygdrive/e/fs1.bak hosts allow = fs1 [FS2] path = /cygdrive/e/fs2.bak hosts allow = fs2 <EOF> <rsyncd_install.bat> c:\bin\instsrv.exe rsyncd "c:\bin\srvany.exe" c:\bin\rsyncd.reg pause <EOF> <rsyncd_remove.bat> net stop rsyncd c:\bin\kill.exe rsync c:\bin\instsrv.exe rsyncd remove pause <EOF> <rsyncd_restart.bat> net stop rsyncd c:\bin\kill.exe rsync net start rsyncd pause <EOF> <rsyncd_stop.bat> net stop rsyncd c:\bin\kill.exe rsync pause <EOF> <rsyncd.reg> REGEDIT4 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\rsyncd] [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\rsyncd\Parameters] "AppDirectory"="c:\\program files\\rsync" "Application"="c:\\program files\\rsync\\rsync.exe" "AppParameters"="--daemon --config=rsyncd.conf" <EOF> <rsyncd_schedule.bat> at \\fs1 10:00pm /every:m,t,w,th,f,s,su c:\bin\rsync.bat at \\fs2 11:00pm /every:m,t,w,th,f,s,su c:\bin\rsync.bat <EOF> Then double-click on thse for the initial setup: rsync_install.bat rsync_restart.bat rsync_schedule.bat Use these to manage the service: rsync_stop.bat rsync_restart.bat Use this to uninstall: rsync_remove.bat Easy, simple and clean! JF
On Thursday 22 Nov 01, JF Paradis writes:> Here is how: > > Use the KILL.EXE from the NT Resource kit. > > On my systems, I use the NT scheduler to run > batch files (using the default AT or the GUI > WINAT.EXE from the NT resource kit). > > At the start of each batch file, I use: > c:\bin\KILL.EXE rsync > > This ensure that rsync is not already running! > > Here is my setup: > 1. No need to install cygwin > 2. I have FS1 & FS2 to backup on FSX > 3. The same client batch file is used (use %COMPTUERNAME%) > 4. I backup the client e: drive to the server .bak folders > > Put into c:\bin of all machines: > - rsync.exe > - cygwin1.dll > - kill.exe > - srvany.exe > - instsrv.exeTwo remarks: If you ever do choose to install Cygwin properly, having more than one copy of cygwin1.dll will cause you problems. (And indirectly cause problems for the Cygwin support mailing list, which is why Cygwin support types like me are vocal about not advertising this approach to joe-user.) Not everyone will have kill.exe, srvany.exe, ... because the NT Resource Kit is not freely available. Cheers, David (Cygwin FAQ maintainer)
Hello all I have been watching and learning from this list for a couple of months now.. Here is my first question. If rsync comes across a file that is in use by somebody. What happens? Does the file get skipped or does the entire transfer halt? The command I am issuing is: rsync -a -c -v -o -e ssh /etc/much_used_file \root@192.168.1.1.:/etc/much_used_file -- Synaptic Solutions 9 Lees Street Northcote 3070 03 9482 5272