I have a script that runs every 10 minutes that looks at a log file. Its not working as I would like. Can you tell me what I'm doing wrong?
You would see Completed successfully in which case I want script to shoot me a message.
If there is a failure you would see failed in log which I want it to shoot me a message.
If neither, please dont shoot me a message (process would still be running in which I dont need alert).
Currently I get a message saying completed successfully and when I check it hasnt completed. Im guessing I have it scripted in a way that it will shoot me that alert regardless? Please assist.
failmsg=`tail -6 $1 |grep -i FAILED`
if [[ $? = 0 ]];then
mail -s "Failed... please check..." #@vtext.com < /dev/null
runmsg=`tail -6 $1 |grep -i Completed Successfully`
if [[ $? != 0 ]];then
mail -s "Completed.." #@vtext.com < /dev/null