Re: A script that will only check file if it has been modified since last check

phn_at_icke-reklam.ipsec.nu
Date: 05/06/03


Date: Tue, 6 May 2003 21:21:26 +0000 (UTC)

In comp.security.unix LHradowy <laura.hradowy@nospam.mts.ca> wrote:
> I have a script that greps the /var/adm/messages file for a pattern, write
> it to a file. Then emails me a warning.

> The thing is I want to run this regularly, and the messages file is not
> rotated regularly. How do I add this to the script that I only want it to
> grep the file and email me if there is a new "pattern" not the same
> "pattern" from an hour ago, or yesterday.

> grep "currently marked as unusable" $ADMSG > $TEMP
> grep "No more IP addresses on 192.168.2.0 network" $ADMSG >> $TEMP
> if [ -s $TEMP ]
> then
> /usr/sbin/pntadm -P 192.168.2 >> $TEMP
> fi

> #rm -f $TEMP

Install a separate "sink" in syslog.conf, piping to your
pattern-recognition program. Then you don't have to deal
with files at all.

-- 
Peter Håkanson         
        IPSec  Sverige      ( At Gothenburg Riverside )
           Sorry about my e-mail address, but i'm trying to keep spam out,
	   remove "icke-reklam" if you feel for mailing me. Thanx.


Relevant Pages


Quantcast