OS: SuSE Linux Enterprise Server 10
Goal:
To track the errors in log file, If they exits users will be notify by email.
We have a script below:
SrchKey="SRVE0242I:"
LogFile=/PATHtemOut.log
MailTo="DN@mail.com
http:// ! -f PATH/alert.last && touch PATH/alert.last
egrep $SrchKey $LogFile > PATH/alert.new
if http:// -s PATH/alert.new ;then
diff PATH/alert.new PATH/alert.last > PATH/alert.msg
cp PATH/alert.new PATH/alert.last
http:// -s PATH/alert.msg &&
mailx -v -s "$SrchKey Alert" $MailTo < PATH/alert.msg
else
echo "Nothing to report, sir." | mailx -s "No Alert Today" ${MailTo}
fi
OUT PUT:
Received email
Subject:SRVE0242I: Alert
Message: "1d0
< Binary file /PATH/log/SystemOut.log matches"
1) We have multiple error messages,
how to add more messages in the script?
2) If one of the message does not exits we should receive message for other existing error code or messages.
thanks
D