Another way to setup Rsync as an NT Service

JF Paradis jfparadis at mec.ca
Fri Nov 23 05:09:18 EST 2001


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





More information about the rsync mailing list