inotify實時同步腳本

inotify.sh bash

#!/bin/bash orm


src=/data/www/
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f%e' -e modify,delete,create,attrib $src |  while read file
do
      /usr/bin/rsync -arzuq --delete --progress $src 192.168.136.128::www/
      echo "  ${file} was rsynced" >>/tmp/rsync.log 2>&1
done it


chmod +x inotify.sh 
 
./inotify.sh&    form

 //後臺運行 後臺

相關文章
相關標籤/搜索