uname -r
ls /porc/sys/fs/inotify/
wget -O /etc/yum.repos.d/epel.repo http:mirrors.aliyun.com/repo/epel-6.repo
yum -y install inotify-tools
inotifywait -mrq --timefmt '%d%m%y %H%M' --format '%T%f' -e close_write,delete /data
以下是脚本内容
vim /server/script/inotify.sh
#!/bin/bash
/usr/bin/inotifywait -mrq --timefmt '%d%m%y %H%M' --format '%T%f' -e close_write,delete /data \
| while read file
do
cd /data&&\
rsync -az ./ --delete rsync_backup@172.16.1.41::backup/ --password-file=/etc/rsync.password
done
####end####
执行
sh inotify.sh