Monitor log file thru shell script

From: Shivaswamy / ಶಿವಸ್ವಾಮಿ <>
Date: Tue, 8 Jul 2008 16:57:26 -0400
Message-ID: <>


I am attempting to look for a pattern in the continuously growing log file and mail me if match is found. (on Linux). But I am having problem. This is the part of the shell script
export err1=down
tail -f testlogfile | egrep -n "${err1}" | mail -s "Found warning"
As you see I am using tail -f and egrep. When I run only tail -f & egrep part on the prompt on my testlogfile, I am able to see the output from egrep.
But when I pipe it to mail, and run it on nohup on a shell script, nothing happens. I can see that mail process is in T state, meaning it is stopped. If I kill my shell script running in the background, I get the email notification, as expected.
What happens here? How I can get the notification, without killing the process?
If you could please help, I appreciate it. Thanks,

Received on Tue Jul 08 2008 - 15:57:26 CDT

Original text of this message