Originally posted by: SystemAdmin
I have this script running on 3 servers to keep me sane. It does require you to install the GNU date found in the coreutils package that came in the install disks (that's how I got around the problem of the beginning of the month). It's run with a crontab entry every morning at a convenient time.
#!/bin/ksh
errdate=$(/opt/freeware/bin/date --date="-1 days" +"%m%d0000%y")
curdir=$(find / -name mailerrs 2>/dev/null | awk -F/ '{ ORS="/"; for( i=1; i<NF; i++ ) print $i }')
outfile=$(print ${curdir}lasterrs.log)
sendto="unix@admin.email"
subject="$(uname -n) errors found over last day"
errpt -a -s $errdate > $outfile
if
then
mail -s "$subject" $sendto < $outfile
fi
#AIX-Forum