when you use this script you need create zhiwen.db file and wenjian.db file in frist.
#! /bin/bash
RETVAL=0
export LANG=en
CHECK_DIR=/var/html/www
[ -e $CHECK_DIR ] || exit 1
ZhiWenDbOri="/opt/zhiwen.db"
FileCountDbOri="/opt/wenjian.db"
ErrLog="/opt/err.log"
[ -e $ZhiWenDbOri ] || exit 1
[ -e $FileCountDbOri ] || exit 1

echo "[root@rhel1 scripts]# md5sum -c --quiet /opt/zhiwen.db" >$ErrLog
md5sum -c --quiet /opt/zhiwen.db.ori &>>$ErrLog
RETVAL=$?
find $CHECK_DIR -type f > /opt/wenjian.db_curr.ori
echo "[root@rhel1 scripts}# md5sum -c --quiet /opt/wenjian.bd" &>> $ErrLog
diff /opt/wenjian.db
&>>$ErrLog
if [ $RETVAL -ne 0 -o diff /opt/wenjina.db*|wc -l -ne 0 ];then
mail -s "uname -n $(date +%F) err" [email protected] <$ErrLog
else
echo "Sites dir is ok"|mail -s "uname -n $(date +%F) is ok" [email protected]
fi