码迷,mamicode.com
首页 > 其他好文 > 详细

rsync+inotify配置笔记

时间:2014-10-17 12:13:26      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:io   os   ar   for   sp   文件   on   cti   log   

rsync+innotify端配置文件脚本

src=/data/tfCarFace/
DB_slave2=10.171.54.183
DB_slave1=10.162.209.36
atlas1=10.162.211.200
atlas2=10.171.53.150
DB_master1=10.162.213.176
DB_master2=10.165.65.246
user=test
ds1=DB-slave2
ds2=atlas1
ds3=atlas2
ds4=DB-slave1
ds5=DB-master1
ds6=DB-master2
#passwdfile=/etc/rsyncd.pass
  /usr/bin/inotifywait -mrq --timefmt ‘%d%m%y %H:%M‘ --format ‘%T %w%f%e‘ -e create,delete,modify,attrib $src   | while read files
    do
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_slave2::$ds1  > /dev/null 2>&1
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$atlas1::$ds2  > /dev/null 2>&1
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$atlas2::$ds3  > /dev/null 2>&1
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_slave1::$ds4  > /dev/null 2>&1
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_master1::$ds5  > /dev/null 2>&1
/usr/bin/rsync -vzrtopg  --delete --exclude "tfcfg.ini" --progress --password-file=/etc/rsyncd.pass $src $user@$DB_master2::$ds6  > /dev/null 2>&1
        echo "${files} was rsynced" >>/tmp/rsync.log 2>&1
    done
需要同步的客户端配置

uid=root
gid=root
max connections=10
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock

[atlas1]
path=/data/tfCarFace/
comment = TfCarFace backup
ignore errors = yes
read only = no
auth users=test
secrets file=/etc/rsyncd.pass
hosts allow = 10.0.0.0/8
hosts deny = *




rsync+inotify配置笔记

标签:io   os   ar   for   sp   文件   on   cti   log   

原文地址:http://my.oschina.net/kcw/blog/333137

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!