rsync+inotify

#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+inotify)