Shell脚本实现检测文件是否被修改过代码分享
更新时间:2014年09月17日 08:48:06 投稿:junjie
这篇文章主要介绍了Shell脚本实现的检测文件是否被修改代码分享,其实了解了原理就可以做很多事了,需要的朋友可以参考下
#!/bin/bash
funmd5_1() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_1.log
}
funmd5_2() {
find /root/passwd -type f | xargs md5sum > /tmp/funmd5_2.log
}
if [ ! -f /tmp/funmd5_1.log ];then
funmd5_1
fi
funmd5_2
diff /tmp/funmd5_1.log /tmp/funmd5_2.log > /tmp/diff.log
Status=$?
if [ $Status = 0 ];then
exit
else
echo "文件修改过了!"
fi
您可能感兴趣的文章:
相关文章
crontab设置每分钟、每小时、每天、每周、每月、每年定时执行的脚本
这篇文章主要介绍了crontab设置每分钟、每小时、每天、每周、每月、每年定时执行,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2023-04-04


最新评论