Quote:
Originally Posted by elainelaw
thx reply ,
instead of use logwatch , as I tried to setup logwatch ,but it is too difficult to me , is there any method ( script ) do it ? please advise .
|
Write a script that does something like this:
1. Read recent log entries and check for the desired text:
Code:
if tail -n 50 < logfilename | grep -q "Unable to run program"
then
# do something here
fi
(choose how many lines you need to read -- 50 is just an example)
2. In the above "do something here" position, send an e-mail to a specified recipient:
Code:
echo “program so-and-so failed to run at `date`” | mail -s “Program Launch Failure” user@domain.com
3. Run the sequence above periodically from cron.
It's really easy to set up something like this.