#!/bin/sh if [ "$1" = "--help" ] ; then echo Monitoring utility for the blackhole system. echo It is executed fron cron every 5 minutes, without arguments. echo See the man page. exit 1 fi LOGDIR=/var/log/blackhole mkdir -p $LOGDIR check(){ LOG=$LOGDIR/$1 /usr/sbin/blackhole-control $1 >$LOG.tmp if [ -s $LOG.tmp ] ; then if cmp --quiet $LOG.tmp $LOG.sent then true # Nothing to do else EMAILS=/etc/blackhole-monitor-emails.lst if [ -f $EMAILS ]; then cat $LOG.tmp | mail -s "blackhole $1" `cat $EMAILS` fi mv -f $LOG.tmp $LOG.sent fi else rm -f $LOG.sent fi } check rejects check statuserr