youdianman 发表于 2013-7-30 09:14:55

inotify+sendEmail 搭建文件监控系统

下载inotify+sendEmailwget http://csa.catelgame.com/down/inotify-tools-3.14.tar.gzwget http://csa.catelgame.com/down/sendEmail-v1.55.tar.gz下载完成后解压安装inotify进入安装包目录./configure –prefix=../inotify && make && make installecho $?编写文件监控报警脚本#i! /bin/bash
#by catelgame-sa-team anxiaodi
../inotifywait -mrq –exclude=”/跳过的路径/”–timefmt ‘%y/%m/%d %H:%M’ –format ‘%T %w%f%e’
-e create 被监控目录多个以空格隔开|while read neirong   ##安装包bin下有相应的执行文件##
do
zhengwen=`echo “$neirong” |grep -a CREATE`
if [ $? = 0 ]
then
#echo “发送邮件”
/usr/local/bin/sendEmail -f 发件人邮箱 -t 收件人邮箱 -s smt
p.exmail.qq.com -u “create” -m “${zhengwen}” -xu 发件人邮箱 -xp 发件人密码
fi
echo “$neirong” >> /root/www-inotify.log
done给脚本授执行权限chmod +x 监控脚本sh 监控脚本 > /dev/null &

alonli 发表于 2013-7-30 10:38:42

恋爱就是无数个饭局,结婚就是一个饭局。

archer05 发表于 2013-7-30 13:09:33

谢谢楼主,共同发展

a2005147 发表于 2013-7-30 17:41:32

学海无涯,回头是岸!

高峰之巅 发表于 2013-7-30 21:49:48

做爱做的事,交配交的人。

jdxyzlh 发表于 2013-7-30 22:31:36

下雨了,别忘了打伞,湿身是小,淋病就麻烦啦*^_^*

永不落伍 发表于 2013-7-31 06:24:40

我是来刷分的,嘿嘿
页: [1]
查看完整版本: inotify+sendEmail 搭建文件监控系统