标签:rsync
#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
原文地址:http://neji1983.blog.51cto.com/3330124/1790957