Code: Select all
#!/bin/bash
# Script: check_diff.sh
# Author: Troy Hockman
# Desc: Checks for md5 diffs. If no control file it will create one.
# Usage: Set diffpath for directories needed to monitor seperated by spaces
# Leave the ./check_diff.sh to self check.
# The first run will create the control.md5. If you want to restart rm control.md5.
diffpath="./check_diff.sh /etc/"
clear
if [ ! -f "control.md5" ]; then find $diffpath -type f 2>/dev/null -exec md5sum {} \; > control.md5; fi
isfail=$(md5sum -c control.md5 2>/dev/null | grep "FAILED")
if [ "$isfail" ]; then echo $isfail; fi