inotify实时监测文件变化并同步到远程机器
#!/bin/bash INOTIFY_CMD="inotifywait -mrq -e create,delete,move,modify,attrib /srv/salt/us-west" RSYNC_CMD="rsync -avrz --delete --bwlimit=20000 --port 61873 --password-file=/etc/us-west-salt.psw /srv/salt/us-west/* salt@54.203.210.244::US-WEST" $INOTIFY_CMD | while read DIRECTORY EVENT FILE do if [ $(pgrep rsync | wc -l) -le 0 ] ; then $RSYNC_CMD fi done

浙公网安备 33010602011771号