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

From: John Prather (jprather_at_uci.edu)
Date: 05/09/03

  • Next message: Barry Margolin: "Re: Closing ports-- in services or inetd.conf?"
    Date: Thu, 08 May 2003 16:08:33 -0700
    
    

    >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
    >
    cp $TEMP $TEMP.last

    grep "currently marked as unusable" $ADMSG > $TEMP
    grep "No more IP addresses on 192.168.2.0 network" $ADMSG >> $TEMP
    if [ -s $TEMP ]
    then
      diff $TEMP $TEMP.last > /dev/null 2> /dev/null
      if [ $? != "0" ]
      then
        cat $TEMP | mail -s "Log Warnings" yourself@your.dom
        # or use your pntadm if that was your notification
      fi
    fi

    or similar should do the trick.

    You will always have $TEMP and $TEMP.last (if you delete, you will get a
    message about all the messages in your log again and the $TEMP's will be
    recreated.)

    The diff verifies that files differed from last check or were
    nonexistant before a notification is sent out.


  • Next message: Barry Margolin: "Re: Closing ports-- in services or inetd.conf?"

    Relevant Pages