码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本***检测与邮件报警

时间:2019-03-20 13:15:52      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:mail -s   www   wc -l   web   邮件   $?   lse   log   count   

#!/bin/bash
webdir=/var/www/html
cd $webdir
md5sum -c --quiet /opt/sumfile.db &>/opt/sum_err.log
if [ $? -ne 0 ]
then
echo "the file_sum is changed"
mail -s "sum_error" wcg@bw.com </opt/sum_err.log
else
echo "check file_sum is ok"
fi

find /var/www/html/ -type f >/opt/countfile.dbsec
diff /opt/countfile.db
&>/opt/counterr.log
if [ $(diff /opt/countfile.db
|wc -l) -gt 0 ]
then
echo "the file_count is changed"
mail -s "count_err" wcg@bw.com </opt/count_err.log
else
echo "check file_count is ok"
fi

shell脚本***检测与邮件报警

标签:mail -s   www   wc -l   web   邮件   $?   lse   log   count   

原文地址:https://blog.51cto.com/14241151/2365811

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!