1. 检查环境支持。

    1. 内核版本需要高于2.6.13

    2. 图中3个文件必须存在才能正常支持 

       实时同步工具INOTIFY学习笔记

2. 安装

    wget inotify-tools

    ./configure --prefix=/path

    make && make install

 

3. /usr/local/inotify/bin/inotifywait -mrq --timefmt '%d/%m/%y %H:%M' --format '%T %w%f' -e create /backup

  

4. inotify+rsync实时同步简单脚本。

###############################################################

  #!/bin/bash

  datapath=/home/data/

  cmd="/usr/local/inotify/bin/inotifywait"

  $cmd -mrq --format "%w%f" -e create,delete,close_write,attrib $datapath | \

  while read line

  do

      cd $datapath &&

      rsync -az --delete $datapath [email protected]::asling/ --password-file=/etc/rsync.password >/dev/null 2>&1

  done

  exit 0

################################################################

实时同步工具INOTIFY学习笔记


或者

实时同步工具INOTIFY学习笔记

5. 优化

    实时同步工具INOTIFY学习笔记

    检查3个数值,修改。

转载于:https://blog.51cto.com/xiangpang/1712661

相关文章:

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