Re: Monitor log file thru shell script

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Wed, 09 Jul 2008 10:01:53 +0200
Message-ID: <48747071.90300@gmail.com>

 

Shivaswamy / ????????? wrote:
[...]
>> 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. [...]

> You could use something like this:
>
> err1=down
> tail -f logfile |
> while IFS= read -r; do
> case $REPLY in
> "$err1" ) mail -s "Found warning" your_email_at_address ;;
> esac
>
> done

(Sorry for the wrong encoding in the previous email.)

You could adjust the pattern using wildcards:

err1=down
tail -f logfile |
  while IFS= read -r; do
    case $REPLY in
      *"$err1"* ) mail -s "Found warning" your_email_at_address ;;     esac
  done

Regards
Dimitre

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jul 09 2008 - 03:01:53 CDT

Original text of this message