inotify 同步脚本

#!/bin/bash

path1=/home/htoa/tomcat/webapps/ROOT/htoa/
ip=192.168.30.13

/usr/bin/inotifywait -mrq --timefmt %y/%m'%d %H:/%M' --format '%T %w%f' -emodify,delete,create,attrib $path1 | while read file;
do
rsync -avz --delete  --progress --exclude-from="/usr/local/src/scripts/exclude.list" $path1 root@$ip:$path1
echo "${file} was rsynced" >> /var/log/rsync.log 2>&1
done

 

posted @ 2018-05-23 18:17  wangmo  阅读(419)  评论(0编辑  收藏  举报