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

猜你喜欢

转载自www.cnblogs.com/wangmo/p/9078315.html