In that case, I'd probably have a config file that saves each event type along with a timestamp of the last email sent for that type. That could be done with any module that can save key/value pairs in a file. Then, in pseudo-code:
when there is an event, get the type (A)
if there is a timestamp saved for A
and if the timestamp is less than 1 hour old
do nothing
otherwise send an email about A
and update the timestamp for A with the current time
Do it like that, and you can run your script as often as you like without getting extra emails.
Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.
|