1.安装依赖
yum install -y gcc gcc-c++ make
2.下载源码包
wget https://nchc.dl.sourceforge.net/project/inotify-tools/inotify-tools/3.13/inotify-tools-3.13.tar.gz
3.解压安装
tar xf inotify-tools-3.13.tar.gz cd inotify-tools-3.13 ./configure make make install
4.编写同步脚本
vim rsync.sh
while inotifywait -rqq /opt/soft # 监控/opt/soft是否发生变化
do
rsync -a --delete /opt/soft root@192.168.4.12:/opt # 如果发生变化 就执行同步操作
done
chmod +x rsync.sh ./rsync.sh &
Comments NOTHING