您的位置:首页 > 其它

rsync+inotify

2016-06-20 11:10 183 查看
#rsync-server配置
uid = nobody
gid = nobody
use chroot = no
max connections = 10
strict modes = yes
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = 10.7.0.0/24

[server1]
path = /var/www/extsuite
commnet = backup
ignore errors
read only = no
write only = no
list = false
uid = root
uid = root
auth users = backup
secrets file = /etc/server.pass


#下载inotify
tar zxf inotify-tools-3.14.tar.gz
cd inotify-tools-3.14
./configure --prefix=/usr/local/inotify-3.14
make && make install
nohup /bin/bash /sh/rsync.sh &
echo "nohup /bin/bash /sh/rsync.sh &" >> /etc/rc.local
#for bash
#!/bin/bash
src=/home/domains/xxx/  #本地监控的目录
des=Email-file         #13server的rsync服务的模块名
host=10.7.0.xxx  #备份服务器的ip地址
/usr/local/inotify-3.14/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e modify,delete,create,attrib $src | while read files
do
for hostip in $host
do
rsync -vzrtopg --delete --progress --password-file=/etc/server.pass  $src rsync_backup@$hostip::$des
done
echo "${files} was rsynced" >>/tmp/rsync.log 2>&1
done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  rsync