在windows上使用rsync

This document assumes that you want to install rsync as a daemon on a WindowsXP/2k/2k3 boxes and use it to backup your NT machines from a central DeniX server.

You will need the following files:

From Cygwin:

cygpopt-0.dll
cygwin1.dll
rsync.exe
From the Windows NT or 2000 Resource Kit.

instsrv.exe
srvany.exe
You can download all theese files in one self-extracting archive here

If you follow the following instructions you will an rsync service on your windows machine, running one large WORLD READABLE area. Please be careful where you place the server as any one who can see it can read this volume.

1) Create directory c:\rsync
2) Place rsync.exe instsrv.exe and srvany.exe in c:\rsync
3) Copy cygwin1.dll and cygpopt-0.dll to c:\windows\system32
4) Start the cmd shell and input this command:

c:\rsync>instsrv Rsync "c:\rsync\srvany.exe"

5) You should now have a new service called Rsync and you can verify by looking in Start->Control Panel->Services DON'T START IT YET! Open the properties of this service and change: Log On --> Log on as: Local system account.
6) If you want to run rsync in daemon mode you will need a configuration file. Here is the sample, call it rsyncd.conf and place it in the same directory as rsync (c:\rsync\rsyncd.conf)

use chroot = no
strict modes = no
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid

[win_data]

path = /cygdrive/d/MyFiles/
read only = yes


This example configuration will allow anyone to use rsync to read from d:\MyFiles and might not be ideal for you, change to suit your tastes, but the first two lines are important for rsync to work on Windows.
7) Now we need to hack some keys in the registry to make it work. Don't do this unless you are comfortable with the changes! Run regedit32 and add the following keys and values (quotation marks ARE IMPORTANT):

HKEY_LOCAL_MACHINE->SYSTEM->CurrentControlSet->Services->Rsync

Edit->Add Key-> Key Name: Parameters
Edit->Add Value-> Value Name: AppDirectory Value: "C:\rsync"
Edit->Add Value-> Value Name: Application Value: "C:\rsync\rsync.exe"
Edit->Add Value-> Value Name: AppParameters Value: --config="C:\rsync\rsyncd.conf" --daemon

If you would like to add these keys automatically, run the rsync-param.reg from downloaded archive to merge it into your registry.
8) That's it, you should be able to start and stop the rsync service at will using the Services Control Panel or from cmd shell by command:

net startstop Rsync

When running with the above configuration you should be able to test by attempting to telnet to port 873 from a remote machine.

telnet rsync.server.com 873
You should get a connection to the rsync daemon running on your NT box.

Now you can run the backup process from DeniX server:

rsync -r --delete rsync://rsync.server.com:/win_data /win_backup
This command will backup all files from d:\MyFiles on NT box to /win_backup on DeniX server.

评论

此博客中的热门博文

在南京见到的农民工午饭情景

购买了iacces for iPad

uptime-kuma部署和批量添加