您的位置:首页 > 运维架构 > Linux

centos7下inotify+svn、inotify+rsync的配置

2018-01-03 21:56 281 查看
一、inotify+svn:

安装inotify-tools:
yum  -y  install  inotify-tools


安装svn
yum  -y  install  subversion


启动svn
systemctl  start  svn


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


运行脚本
test.sh

二、inotify+rsync:

安装软件:
yum  -y  install  rsync  inotify-tools


写监控脚本:vim test.sh
#!/bin/bash
while inotifywait -mrq -e modify,create,move,delete,attrib /home/lee/rsync/ ; do
rsync -avz /home/lee/rsync/ --password-file=/root/passwd lee@192.168.8.82::common
done &


运行:
chmod  a+x  test.sh
./test.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息