#!/bin/bash
#菜鸟写脚本
#环境要求: 要先把网页下的所有文件做md5值校验并把校验值写入一个文件
#find /usr/local/nginx/html/ -name *.html -type f -exec md5sum {} > /root/原始校验文件 ;
while :
do
#提取nginx下的所有网页的md5值并写入一个文件
find /usr/local/nginx/html/ -name *.html -type f -exec md5sum {} > /root/md5.jy.txt ;
#对比两个文件 判断当两个文件有变动时会有所提示并显示出那个文件有所变动
diff md5.txt md5.jy.txt
if [ $? -eq 0 ];then
echo “文件完好无变动”
else
echo “文件有变动请校验”
fi
sleep 3 #间隔时间
done