本文介绍了如何使用rsync服务从Linux到Windows进行远程备份
rsync官网下载http://rsync.samba.org/
cwrsync官网下载http://sourceforge.net/projects/sereds/files/cwRsync/
环境
192.168.88.129为rsync server CENTOS 5.5 32位,rsync源码包安装
下面开始安装:
tar zxvf rsync-3.0.8.tar.gz
cd rsync-3.0.8
./configure
make && make install
ln -s /usr/local/bin/rsync /usr/bin/rsync
mkdir /etc/rsyncd
touch /etc/rsyncd/rsyncd.conf
touch /etc/rsyncd/rsyncd.passwd
chmod 600 /etc/rsyncd/rsyncd.passwd
vi /etc/rsyncd/rsyncd.motd 输入欢迎信息
Welcome to rsync system
vi /etc/rsyncd/rsyncd.conf输入:
uid=root
gid=root
max connections=36000
use chroot=no
motd file = /etc/rsyncd/rsyncd.motd
log file=/var/log/rsyncd.log
log format = %t %a %m %f %b
transfer logging = yes
syslog facility = local3
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
hosts allow = 192.168.88.128,192.168.10.0/24
hosts deny = *
timeout=300
[data]
path=/opt
ignore errors = yes
read only = no
list = yes
ignore errors
secrets file = /etc/rsyncd/rsyncd.passwd
linux上启动:
rsync --daemon --config=/etc/rsyncd/rsyncd.conf 第二次启动时要删除/var/run/rsyncd.pid 文件在启动
rsync linux to windows同步
我安装在D盘Program Files
D:Program FilescwRsyncbinrsync.exe -avzrtopg --progress root@192.168.88.129::data /cygdrive/e/backup
cwrsync和rsync有点区别 cygdrive后面接win的盘符,直接输入盘符是不行的
下面写个bat脚本,添加到计划任务每天自动同步
@ECHO ON
d:
cd "D:Program FilescwRsyncbin"
rsync.exe -avzrtopg --progress root@192.168.88.129::data /cygdrive/e/backup
|