inotify事件監控

1、第一個里程碑
搭建好備份服務器,rsync服務
2、啓動inotify
1)配置epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
2)檢查inotify-tools是否安裝
rpm -qa inotify-tools
安裝
yum install -y inotify-tools

3)編寫inotify實時監控腳本
vim inotify.sh
#!/bin/sh
/usr/bin/inotifywait -mrq -e create,delete,close_write /data|
while read line
do
rsync -avz --delete /data/ [email protected]::backup --password-f ile=/etc/rsync.password
done
4)放入後臺運行
sh inotify &

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章