脚本备份-rsync +inotify

/usr/bin/inotifywatch

/usr/bin/inotifywait


#!/bin/sh

SRC=/opt/smc/xuanli

DST=smc@*****:/opt/smc/xuanli

/usr/bin/inotifywait -mrq -e modify,delete,create,attrib ${SRC} | while read D E F

   do

     /usr/bin/rsync -ahqzt --delete $SRC $DST

   done

  1 #!/bin/sh

  2 SRC=/opt/smc/***

  3 DST=***@***:/opt/smc/***/aa01

  4 conf=/opt/smc/****

  5 RSYNC_EXCLUDE="--include-from=$conf/rsync_include.list --exclude-from=$conf/rsync_exclude.list"

  6 INOTIFY_EXCLUDE="--fromfile $conf/inotify_exclude.list"

  7 /usr/bin/inotifywait -mrq  --exclude "(.data|.seq|.swp|.inc|.svn|.rar|.tar.gz|.gz|.txt|.zip|.bak|.log)"  -e modify,delete,cr

    eate,attrib ${SRC}  $INOTIFY_EXCLUDE | while read D E F

  8    do

  9      /usr/bin/rsync -r -ahqzt $RSYNC_EXCLUDE --delete $SRC $DST

 10    done


你可能感兴趣的:(脚本备份-rsync +inotify)