Agnello George wrote:
HI
I have a small query !! I need to write a script whenever there is an
error generated in the spamd.log or any general log file to send me a
mail only once, the bellow script is what i came u with but i doubt it
would work.
if [ $(grep -e "unable to start service" /var/log/spamd.log) = 1 ] ; then
mail -s " pls check server IP 203.185.XXX>XXX" [EMAIL PROTECTED]
fi
Is there any application that can scan the log file for a specific
word or error as soon as the logs are generated. I have even heard of
SMS being sent in some cases.
Your inputs will be of great help
Might I suggest swatch? Why create your own script, when someone's
already created a powerful tool to do this.
http://swatch.sourceforge.net/
There's lots of good articles on using it out there:
http://www.linuxsecurity.com/content/view/117281/50/
http://www.linuxjournal.com/article/4776
You could also use logwatch, but Swatch is probably the better tool for
the job, it's designed to monitor continuously, where as logwatch is
more for daily reports, etc.
http://www.logwatch.org/