Inotify+rsync远程实时同步
安装inotify
yum -y install inotify-tools
写同步脚本
Path=/data
IP=172.16.100.20
/usr/bin/inotfywait -mrq --format '%w%f' -e close_write,delete $Path \
| while read i
do
if [ -f $i ];then
rsync -az $i --delete vir_rsync@Ip::bak_mod --password-file=/etc/rsync.password
else
cd $Path && \
rysnc -az ./ --delete vir_rsync@Ip::bak_mod --password-file=/etc/rsync.password
fi
done
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步