Date: Sat, 27 Oct 2001 17:48:04 -0700 From: "Kory Hamzeh" <kory@avatar.com> To: "Shashi Dookhee" <dookhee.s@trafficproximity.com>, <freebsd-questions@freebsd.org> Subject: RE: How would you do this? Message-ID: <001d01c15f4a$3397f5a0$14ce21c7@avatar.com> In-Reply-To: <MNEAKCLKAEKLKKPGAOJBKEBGEOAA.dookhee.s@trafficproximity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Shashi, My concern is the second time it is run, I need to make sure that I don't send another e-mail because of OLD messages (which I already sent an e-mail for an hour ago). I looks like I need to parse the file and keep the timestamp of the newest log message that triggered the e-mail, and then only check for new messages with newer timestamps. That is something that I don't feel competent enough to do with a scripting language (i.e. convert a syslog time to a absolute number). Kory > -----Original Message----- > From: Shashi Dookhee [mailto:dookhee.s@trafficproximity.com] > Sent: Saturday, October 27, 2001 5:40 PM > To: Kory Hamzeh; freebsd-questions@freebsd.org > Subject: RE: How would you do this? > Importance: High > > > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Set it up in crontab every hour - then it will only send mail once an > hour, every hour (if a message is found - else it will skip that > hour).. > > As for parsing the log, I'd say script it in perl - this is exactly > what it was designed for ;) > > S. > > > > Shashi Dookhee > Head of IT Infrastructure > > e-mail: dookhee.s@trafficproximity.com > Telephone (Direct Line): +44 (0)20 7298 8222 > > > - -----Original Message----- > From: owner-freebsd-questions@FreeBSD.ORG > [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of Kory Hamzeh > Sent: 28 October 2001 01:22 > To: freebsd-questions@freebsd.org > Subject: How would you do this? > > > > I need to write a script (preferably bourne shell) to send an mail > every > time a certain message gets sysloged, but not to send e-mail more > than once > an hour. I can grep /var/log/messages for the message, but I could > not come > up with a simple, clever way of making sure I don't send the e-mail > out more > than once an hour and the next time I grep, that I check for only new > items > logged since the last check. > > Any pointers would be great! > > - -- > Kory Hamzeh > ICQ # 133630494 > http://www.avatar.com/ > http://www.metaphysical-store.com/ > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?001d01c15f4a$3397f5a0$14ce21c7>