1.安装:
[root@work tmp]# yum install epel-release
[root@work tmp]# yum install inotify-tools
2.命令:
inotify-tools包含了两个命令:inotifywait与inotifywatch
(1)inotifywait:在被监控的文件或目录上等待特定文件系统事件发生,执行后处于阻塞状态。适合在shell脚本中使用。
(2)inotifywatch:用于收集文件系统的统计数据,例如发生了多少次inotify事件,某文件被访问了多少次等等。
3.rsync + inotify 实践:
(1)项目环境规划:
1.客户端服务器(运行业务应用,rsync工具包需要安装,但不需要启动服务,需要使用inotify监控事件)
2.服务端服务器(备份服务器,rsync安装部署配置文件并启动后台进程服务,不需要运行inotify)
(2)部署rsync + inotify 同步客户端目录到服务端目录下:
1.客户端 [root@work ~] IP:192.168.137.133 目录:/runtime
服务端:[root@ssh_rsync_ ~] IP:192.168.137.146 目录:/backup
部署rsync+inotify同步/runtim