Hi All,
Thanks for ur suggestions.Sorry for late reply
I followed otheus suggestion and put the code, but it going to infinite loop and not getting any output. I am new to UNIX, so i may be wrong in some pattern.
Code i am using
#!/bin/sh
tail -f EssbaseLog.txt | awk '
BEGIN { email_cmd = "mail -s failure
xxxxx@yyy.com" }
BEGIN { last_found = "NOT AVAILABLE"; last_lineno = 0; }
/[hyperion]/ { last_found = $0; last_lineno = FNR; }
/Error -- not connected/ { print "Found " (FNR-last_lineno) " lines ago:" last_found }'
I have questions on this, as i mentioned if i get error at 2:30 PM, my script will execute and send a report to users.It should also save a text file with that 50 lines for reference.
Then if it runs again on 2:45 it will again send the same error message and it will continue to send the error until log was corrected.
Is there any way we can send only updated errors?
Sorry for amny questions
Any suggestions will be appreciated
Thanks