沃梦达 / IT编程 / 服务器 / 正文

apache web页面的rsync同步

(1)rsync配置文件vim /etc/rsyncd.confuid = rootgid = rootuse chroot = nomax connections = 20pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsyncd.log[web]path = /var/...

(1)rsync配置文件
vim /etc/rsyncd.conf
    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

(2)启动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 &    #不受shell中Ctrl C和shell关闭的影响

同步.bat

@echo off
:1
d:    放d盘
echo同歩中
rsync -av 192.168.1.10::web \APMSer\www\htdocs\ppsping 127.0 -n  2 >nul 2>nul
goto 1

本文标题为:apache web页面的rsync同步