procmail
[Top] [All Lists]

Re: track error messages to limit notification

1998-12-01 13:35:00
Jerry Shenk wrote,

| I'd like a way to have procmail process alert messages but it it gets the
| same alert every 15 minutes, only notify me on the first alert....maybe even
| the first one every day or something like that but not once every 15
| minutes.  Any ideas?

Bennett Todd has recommended swatch, about which I am thoroughly ignorant,
so it may be better than what I'm about to suggest.

One terribly q&d way is to use a cookie file.  Set up a cron job that does
this:

 0 0 * * * echo ALERT\=notyet > $HOME/path/to/.alertyet

Then in your procmail rcfile,

 :0
 * conditions to identify alert messages
 {
  INCLUDERC=$HOME/path/to/.alertyet # reads current value of $ALERT

  :0 # if you've already received one since the last cron job, lose this one
  * ALERT ?? already
  /dev/null

  :0ci # if not, rewrite the cookie file and accept this message
  | echo ALERT\=already > $INCLUDERC

  :0:
  alerts
 }

You can vary the timing of the cron job to let an alert through more often.

<Prev in Thread] Current Thread [Next in Thread>