rsync服务器配置
- rsync配置文件
uid = root
gid = root
use chroot = no
max connections = 20
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[web]
path = /var/www/html/bbs/
ignore errors
read only = yes
hosts allow = 192.168.1.0/24
hosts deny = 0.0.0.0/32
- 启动rsync守护进程
/usr/bin/rsync -daemon
同步脚本
#!/bin/sh
while true
do
/usr/bin/rsync -av 192.168.1.3::web /bbs/>/dev/null 2>&1
sleep 20
done
rsync -vzrtopg 192.168.1.3::web /bbs/
/usr/bin/nohup /bin/sh /usr/local/webserver/tb.sh 2>&1 >/dev/null &
windows下 同步.bat
@echo off
::同步.bat
::后续命令使用的是:UTF-8编码
chcp 65001
:begin
::进入d盘
d:
echo 同歩中
rsync -av 192.168.1.10::web \APMSer\www\htdocs\pps\
::利用ping指令来模拟定时功能
ping 127.0 -n 2 >nul 2>nul
goto begin