# !/bin/bash
webdir=/var/www/html
cd $webdir #方法1 md5sum校验
#md5sum /var/www/html/index.html >/opt/webfile.db
md5sum -c --quiet /opt/webfile.db
if [ $? -eq 0 ]; then
echo "web file is ok"
else
echo "web file is change"
fi
#方法2
find /var/www/html/ -type f >/opt/countfile.db
count=`diff /opt/countfile.db*|wc -1`
if [ $count -gt 0 ]; then
echo "the file_count is changed"
else
echo "ok"
fi
shell入侵检测与邮件警告
最新推荐文章于 2021-10-14 20:08:31 发布