inotifywait+rsync
1、参数查看
inotifywait -h
-e 用来指定要监控的事件(create,move,delete,modify,attrib)
-m 持续监控
-r 递归
-q 简化输出
2、脚本如下
#!/bin/bash inotifywait -mrq -e create,move,delete,modify /var/www/html/ | while read a b c do rsync -azP --delete /var/www/html/ root@10.168.1.64:/web-back done
参阅文档:
http://www.linuxidc.com/Linux/2013-01/77875.htm
本文出自 “老谭linux博客” 博客,请务必保留此出处http://cmdschool.blog.51cto.com/2420395/1730749
原文:http://cmdschool.blog.51cto.com/2420395/1730749