#!/bin/bash
#host1=192.168.1.7
src=/web1/wwwroot/
#dst=web2/wwwroot/
#user=web1
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src \
| while read files
do
/usr/bin/rsync -vzrtopg --delete --progress /web1/wwwroot/ root@192.168.1.7::web2 2>&1
#/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/server.pass $src $user2@$host2::$dst2
#/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/server.pass $src $user3@$host3::$dst3
echo "${files} was rsynced" >>/tmp/rsync.log 2>&1
done
阅读(1519) | 评论(0) | 转发(0) |