Hello All,
this is my first post here and I am new to scripting so please forgive the ignorance.
So i'm trying to write a simple script to send me an error message from a log file.
I have searched on this site and did find something that may work but since i'm so new to scripting I don't quite understand exactly what I need to do.
This is the script that someone posted here before
#!/bin/bash
string=fail
tail -n0 -F /pat/to/file | \
while read LINE
do
if echo "$LINE" | grep "$string" 1>/dev/null 2>&1
then
echo "String found on $HOSTNAME" | mail -s "Subject"
dummy@iam.com
fi
done
my problem is I don't understand some of the info/arguments here.
I just need a simple script that is looking at a log file when it is kicked off.
once the line comes up that I am looking for it will send that line in an email to me.
I also don't want to get the same info over and over again, so once the line is emailed to me, I don't want it to send me the same error again, only new errors.
Here is the actual paths file and string i'm looking for
path=/opt/IBM/WebSphere/AppServer/profiles/Custom01/logs/WCProd*/
LogFile= SystemOut.log
string= "authorization is declined by the back-end system, the response reason code is {0}"
if anyone can help me it would be huge! I really do appreciate it.
thanks
Paul.