一、配置inotify随机启动

vi  /etc/rc.local
nohup /home/jenkins/inotify/inotify.sh > nohup.out 2>&1 &

 

二、inotify同步脚本

#!/bin/bash
#param
src=/home/jenkins/conf/
dst_module=/home/jenkins/conf/
user=jenkins
/usr/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' -e modify,delete,create,attrib ${src} | while read file
do
        rsync -vzrtopg --delete --progress ${src} ${user}@52.81.4.8:${dst_module}
        rsync -vzrtopg --delete --progress ${src} ${user}@52.8.74.8:${dst_module}
        rsync -vzrtopg --delete --progress ${src} ${user}@18.8.120.8:${dst_module}
        echo "${file} was rsyncd" >>/var/log/rsyncd.log 2>&1
done

 

相关文章:

  • 2021-11-05
  • 2022-01-13
  • 2021-09-20
  • 2021-09-02
  • 2021-09-07
猜你喜欢
  • 2021-09-04
  • 2022-01-10
  • 2021-04-14
  • 2022-02-23
  • 2021-10-20
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案