#主机配置单发生改变,从机会更新配置单。
#需要提前部署软件和免密登入功能
在这里插入代码片
#!/bin/bash
INOTIFY_CMD="/usr/local/bin/inotifywait -mrq -e modify,create,move,delete /****/****r/***"
$INOTIFY_CMD | while read DIRECTORY EVENT FILE
do
/usr/bin/rsync -ravz --include '****/****/*****.txt' --include '****/****r/***ypes.txt' --exclude "*.swp" --exclude "*.swx" --exclude "*.txt" --exclude "*.out" --exclude "*.err" --exclude "web/logs/*" --exclude "web/txt/*" --exclude 'tools/snmpcenter/*' /****/****r/*** root@*.*.*.71:/detector/app
/usr/bin/rsync -ravz --include '****/****/*****.txt' --include '****/****r/***ypes.txt' --exclude "*.swp" --exclude "*.swx" --exclude "*.txt" --exclude "*.out" --exclude "*.err" --exclude "web/logs/*" --exclude "web/txt/*" --exclude 'tools/snmpcenter/*' /****/****r/*** root@*.*.*.72:/detector/app
/usr/bin/rsync --include '****/****/*****.txt' --include '****/****r/***ypes.txt' -ravz --exclude "*.swp" --exclude "*.swx" --exclude "*.txt" --exclude "*.out" --exclude "*.err" --exclude "web/logs/*" --exclude "web/txt/*" --exclude 'tools/snmpcenter/*' /****/****r/*** root@*.*.*.73:/detector/app
/usr/bin/rsync --include '****/****/*****.txt' --include '****/****r/***ypes.txt' -ravz --exclude "*.swp" --exclude "*.swx" --exclude "*.txt" --exclude "*.out" --exclude "*.err" --exclude "web/logs/*" --exclude "web/txt/*" --exclude 'tools/snmpcenter/*' /****/****r/*** root@*.*.*.74:/detector/app
/usr/bin/rsync --include '****/****/*****.txt' --include '****/****r/***ypes.txt' -ravz --exclude "*.swp" --exclude "*.swx" --exclude "*.txt" --exclude "*.out" --exclude "*.err" --exclude "web/logs/*" --exclude "web/txt/*" --exclude 'tools/snmpcenter/*' /****/****r/*** root@*.*.*.75:/detector/app
done``
nohup sh /d**ec**/**/inotify_rsync.sh >/dev/null 2>& 1 &
inotify_rsync.sh 同步脚本
最新推荐文章于 2024-11-15 22:25:12 发布