On 2006-07-28 at 14:03 +0200, Marc Haber wrote: > On Wed, Jul 26, 2006 at 11:12:42AM +0200, Marc Haber wrote: > > I would be willing to accept a patch to the daily cron job which would > > yell into syslog, try to send an e-mail (by directly calling > > /usr/lib/sendmail and reporting a non-zero exit code to syslog and > > probably somewhere else). A hook would be nice at this place as well, > > allowing the local admin to have his local reporting method (like a > > nagios passive service check or writing a warning to /etc/motd) hooked > > in. > > What do you think about this code: > > log_this() { > TEXT="$@" > if ! logger -t exim4 -p mail.alert $TEXT; then > RET="$?" > echo >&2 "ALERT: could not syslog $TEXT, logger return value $RET" > fi > } > > if [ "$WATCH_PANICLOG" = "yes" ]; then > if [ -s "/var/log/exim4/paniclog" ]; then > if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then > /usr/local/lib/exim4/nonzero_paniclog_hook > fi > log_this "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, > mail system possibly broken" > if ! echo -e "Subject: exim paniclog on $(hostname) has non-zero > size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on $(hostname) has > non-zero size, mail system might be broken" | exim4 root; then > log_this "PANIC: sending out e-mail warning has failed, exim has > non-zero return code" > fi > fi > fi > > with WATCH_PANICLOG being preset to "yes"? > > Greetings > Marc
Looks good to me. -- Andrew Ferrier mobile: +44 (0) 7968 147953 email: [EMAIL PROTECTED] photo gallery: www.new-destiny.co.uk/andrew/gallery2/ blog: www.new-destiny.co.uk/andrew/blog/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]