一、inotify+svn:

  1. 安装inotify-tools:
yum  -y  install  inotify-tools
  1. 安装svn
yum  -y  install  subversion
  1. 启动svn
svnserve  -d  -r  /home/lee/svn/test
  1. 编写脚本文件test.sh,实现svn与网站服务器上的数据同步
#!/bin/bash
while  inotifywait -rq  -e  moved_to  /home/lee/svn/db/revs/0/  &>  /dev/null; do
    sleep 1; (注意这里要让系统休眠1秒钟,否则同步的是上一个版本的数据)
		svn  checkout  file:////home/lee/svn/test/  /var/www/html  &>  /dev/null;
done  &
  1. 运行脚本
.  test.sh

二、inotify+rsync:

  1. 安装软件:
yum  -y  install  rsync  inotify-tools
  1. 配置rsync:
参考:http://blog.51cto.com/12173069/2069243
  1. 写监控脚本:vim test.sh
#!/bin/bash
while inotifywait -rq -e modify,create,move,delete,attrib /home/lee/rsync/  &>  /dev/null ; do
    rsync -avz /home/lee/rsync/ --password-file=/root/passwd lee@192.168.8.82::common  &>  /dev/null
done &
  1. 创建密码应答文件: vim /root/passwd
123456
  1. 运行:
chmod  a+x  test.sh
./test.sh