ReportErrors.ksh
#!/bin/ksh
# ReportErrors.ksh
# Reports new errors in the error
# report.
# - Jim
# Create a subject for the email.
Subject="New Errors from errpt on `hostname`"
# Move the error report data to a saved
# copy.
cd /tmp
# Create the file if not there.
touch ErrorReport
mv ErrorReport ErrorReport.old
# Gather the latest info.
errpt > ErrorReport
# Check for the common problem of not being
# able to read /var/adm/ras/errlog.
ErrorCheck=`grep "Unable to process the error log file /var/adm/ras/errlog" ErrorReport`
if [[ "$ErrorCheck" != "" ]];
then
# You hit the problem.
# Sleep for 1.5 minutes, and try again.
sleep 90
errpt > ErrorReport
fi
# Compare the error report now, with the old one.
diff ErrorReport ErrorReport.old | grep \< > ErrorReport.diff
# See if there were any new errors.
# If so, mail the difference.
if (test -s ErrorReport.diff); then
mail -s "$Subject" none@none.com < ErrorReport.diff
fi