The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Federated Event Systems: The Event Web iBot Complex Event Processing RSS News 0 05-16-2008 12:50 AM
Simple Event Processing != Complex Event Processing iBot Complex Event Processing RSS News 0 12-16-2007 09:10 AM
Event Streams and Event Clouds Revisited iBot Complex Event Processing RSS News 0 08-09-2007 08:50 PM
automated ftp. sangfroid Shell Programming and Scripting 10 05-07-2007 08:52 AM
Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win) Vetrivela UNIX for Advanced & Expert Users 2 02-15-2005 07:43 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-26-2006
Registered User
 

Join Date: May 2006
Posts: 1
automated email on a log event

I am monitoring a logfile using tail -f file.log|"ERROR"

I would like to write a korn script that monitors this for me and emails me if the event happens. It would be great if it attached the file to the email as well.

Any Ideas?
Reply With Quote
Forum Sponsor
  #2  
Old 05-26-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
Code:
while true
do
      tail  -f file.log | grep -q 'ERROR'
      if [ $? -eq 0 ] ; then
            cat file.log | /usr/bin/mailx -s 'logfile error' me@whereIam.com
            break
      fi
done
NOTE: this is a lame example because the loop never ends on a file that doesn't have errors. I have no idea what will tell you (using another similar grep check for success)
when to exit the loop.
Reply With Quote
  #3  
Old 05-27-2006
LivinFree's Avatar
Goober Extraordinaire
 

Join Date: Jul 2001
Location: Portland, OR, USA
Posts: 1,584
What about this: http://www.unix.com/showthread.php?p...#post302073804
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0