Jones wrote:
> Guys!!
>
> I am try to build up a shell script which scans for permenant hardware
> errors in AIX error log and mail to specific users about these errors!!
>
> i have nearly succeded in doing so , but stuck up at one step...
>
> See , i am using errpt -s command with current date/time of system (
> and this date/time is off course is the system time at which the script
> is run by cron)....
>
> problem is that how can i insert date value of 24 hours back ( from
> current system time ) with errpt -s .... as i want to scan for only
> those errors which arrive in last 24 hours only....
>
>
> Does somebody help me for providing any way to scan for errors in last
> 24 hours only..
>
> Thanks in advance
>
> Jones
>
I use this small script every night to mail the errors of the day.
It is launched by cron at 23:59 to get the date and it sleeps 70 seconds
for the last minute errors.
It runs on all my AIX. The mail whith "NONE" text is usefull even if
there are no error to report: I must receive one mail per AIX system. If
I not there is a problem on the server/workstation.
#!/bin/ksh
# Le but de ce fichier est de recuperer les messages d'erreur et de
# les transmettre a l'administrateur
#
# Doit s'executer tous les soirs a 23h59 heures (pour ne pas gerer jour-1)
#
qui=`hostname`
la_date=`date +%m%d`
l_annee=`date +%y`
mail_date=`date +%d_%h_%y`
sleep 70
echo "Liste des erreurs sur ${qui}" > /tmp/${qui}.errors
echo "" >> /tmp/${qui}.errors
errpt -s ${la_date}0000${l_annee} >> /tmp/${qui}.errors
nb=`cat /tmp/${qui}.errors |wc -l`
if [ $nb -eq 2 ]
then
echo "NONE" >> /tmp/${qui}.errors
fi
mail -s ${qui}_errors_$mail_date
you@your.email </tmp/${qui}.errors
/bin/rm -f /tmp/${qui}.errors
Patrick