Here is an idea to get you started.
#!/bin/sh
logfile="/logdir/logfile" #your log here.
DB="/tmp/clobber.txt" #random rw file here.
size=`ls -l $logfile | awk '{print $5}'` #current size
osize=`awk 'NR == 1 {print $0}' $DB` #recorded size
action() #tests for DB file, creates and reports
{
if [ ! -e $DB ]
then
echo $size > $DB ; echo -e "SizedUP.`date`" | logger
elif [ -z $DB ]
then
echo "$DB was clobbered."
exit 1 > /dev/null
fi
return 0
}
mtest() #tests current and old sizes.
{
if test `echo $size` != `echo $osize`
then
echo "errors found." | mail user@host
fi
}
action ; mtest
I make no claims to be a programmer, and though this works there must be a better way. I have seen this post just sitting here for days so I decided to reply. You can just use the core ideas. I would not suggest using this script.
;}
Luck