#!/bin/bash
source_dir=/data/www/game_analys/static
LOG=/root/inotify-backend_static.log

IPS="10.105.37.116 10.105.74.140"

[ -d $source_dir ] || exit 2
inotifywait -rmq --timefmt '%Y%m%d%H:%M' --format '%T %e %w%f' -e create,move,delete,modify,CLOSE_WRITE $source_dir |  while read line;do
    echo -e "\n\n[`date +%F_%T`]" >> $LOG
    echo $line >> $LOG
    #delete_file=`cat inotify.log |grep DELETE|awk '{printf $3" "}'`
    #changed_file=`find $source_dir -mtime -1 |xargs echo`
    for ip in $IPS
    do
        echo -e "\n\n[`date +%F_%T`] $ip" >> /root/rsync-backend_static.log
        rsync -azv -P --delete --password-file=/etc/rsyncd.scrt $source_dir dbrNGai@$ip::backend_static >> /root/rsync-backend_static.log
    done
done

 

相关文章:

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