该脚本比较简单,判断网站根目录是否被篡改,如果被篡改把篡改的文件发送到管理员邮箱
#!/bin/bash
#author:luodi date://
#use md5 to check web site
. /etc/init.d/functions
#var setting
WEBDIR=/var/www/html/web/
KEY=md5key
#to determine whether a file exists
[ -e $WEBDIR ] || exit
[ -f $KEY ] || find $WEBDIR -type f -exec md5sum >>$KEY {} \;
md5sum -c $KEY --quiet >error.file >/dev/null
if [ $? -gt ]
then
action "Check web is error" /bin/false
mail -s "WEB site check error" @qq.com <error.file
else
action "Check web is OK" /bin/true
fi