部署inotify 结合rsync

来源:互联网 发布:乐乎lofte网页版 编辑:程序博客网 时间:2024/05/19 21:40
<pre name="code" class="sql">1.  部署v-lhb-db01:/usr/local# tar xvf inotify-tools.tar inotify-tools/或者 源码包安装:# tar xzvf inotify-tools-3.14.tar.gz# cd inotify-tools-3.13# ./configure  --prefix=/usr/local/inotify# make# make install2. /usr/local/inotify-tools/bin/inotifywait -mrq --timefmt %Y/%m/%d %H:%M --format %T %w%f%e -e close_write,create,move,delete,modify /var/www/zjzc-web-frontEnd/news/v-lhb-db01:/usr/local# cat rsync_inotify.sh #!/bin/bashINOTIFY_RSYNC_LOG_DIR=/var/log/inotify_rsyncif [ -d "$INOTIFY_RSYNC_LOG_DIR" ]then        :else        mkdir -p $INOTIFY_RSYNC_LOG_DIRfiINOTIFY_RSYNC_LOG_FILE=$INOTIFY_RSYNC_LOG_DIR/inotify_rsync_contract.logecho >$INOTIFY_RSYNC_LOG_FILEINWT=/usr/local/inotify-tools/bin/inotifywaitRSYNC=/usr/local/rsync/bin/rsyncSRC_FS1=/var/www/zjzc-web-frontEnd/news/DES_HOST1=192.168.32.119DES_USER=rootDES_MODULE1=contract$INWT -mrq --timefmt '%Y/%m/%d %H:%M' --format '%T %w%f%e' -e close_write,create,move,delete,modify $SRC_FS1 | while read FILES do        $RSYNC -avz  --password-file=/etc/rsyncd.secrets  $SRC_FS1 ${DES_USER}@${DES_HOST1}::${DES_MODULE1}         echo "$FILES  was rsynced"  >>$INOTIFY_RSYNC_LOG_FILE 2>&1donev-lhb-db01:/usr/local# mkdir -p /var/log/inotify_rsyncv-lhb-db01:/usr/local# sh ./rsync_inotify.sh sending incremental file list./4sent 114 bytes  received 30 bytes  288.00 bytes/sectotal size is 96  speedup is 0.67sending incremental file listsent 66 bytes  received 8 bytes  49.33 bytes/sectotal size is 96  speedup is 1.30sending incremental file listsent 66 bytes  received 8 bytes  13.45 bytes/sectotal size is 96  speedup is 1.30sending incremental file list4sent 111 bytes  received 33 bytes  288.00 bytes/sectotal size is 93  speedup is 0.65sending incremental file listsent 66 bytes  received 8 bytes  148.00 bytes/sectotal size is 93  speedup is 1.26sending incremental file listsent 66 bytes  received 8 bytes  148.00 bytes/sectotal size is 93  speedup is 1.26


                                             
0 0