#!/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" xx@xx.com </opt/sum_err.log else echo "check file_sum is ok" fi

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