1.配置RSYNC服務器的同步源:html
address = 172.16.23.203 port 873 pid file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log read only = false auth users = chen secrets file = /etc/rsync_user.db [share] comment = soft path=/server/rsyncd
chen:123456
2.inotify+rsyncdlinux
#!/bin/bash
a="/usr/local/bin/inotifywait -mrq -e create,delete /server/rsyncd" b="/usr/bin/rsync -avz /server/rsyncd/* 172.16.23.204:/client/rsyncd" $a | while read diretory event file do $b done
執行 bash a.sh & 放到後臺執行bash
3.inotify+unison服務器
安裝軟件:inotify-tools-3.14.tar.gz ocaml-3.10.0.tar.gz unison-2.13.16.tar.gzssh
#!/bin/bash a="/usr/local/bin/inotifywait -mrq -e create,delete /server1" b="/usr/bin/unison -batch /server1 ssh://172.16.23.204//server2" $a | while read diretory event file do $b done