>
> Sure -- happy to share... it's pretty brute force, but I don't have a
> lot of time for "clean" development!
>
> Remember: I reset the name of my mtrack command to qmtrack... (Bolding
> the non-commented lines is just my way of making them stand out)
> #! /bin/bash
> # $0 (or check-failures.sh) - (should run every 15 minutes from a cron
> job... so ensure there is no output!)
> # NOTE: If run with no arguments (e.g. from cron), the report is run
> for TODAY
> # if 1 argument, the report is run for the STARTING VALUE entered
> # $0 11 would run the report for all of November
> # $0 11-11 would run the report solely for November 11 (no matter
> what day today is)
> # if 2 arguments, the report is run for the MONTH and DAY provided
> # $0 11 11 would run the report for November 11 (no matter what day
> today is)
> #
> # Delete old log files
> rm -f /tmp/send*
> #
> # Process Args
> if [ $# -eq 0 ] ; then
> TODAY=`/bin/date +"%m-%d"`
> elif [ $# -eq 1 ] ; then
> TODAY="$1"
> elif [ $# -eq 2 ] ; then
> TODAY="$1-$2"
> else
> echo "Usage: $0 [month] | [month] [day] " 1>&2
> exit 1
> fi
> #
> # Create "nice" logs for the period requested
> /usr/sbin/qmlog send | grep "^${TODAY}"> /tmp/send-${TODAY}
> # Look for faliures
> /it4soho/sbin/qmtrack -p fail /tmp/send-${TODAY}> /tmp/send-${TODAY}-fail
> # Count failures
> FAILURES=`grep 'failure:' /tmp/send-${TODAY}-fail | wc -l`
> # If too many, send an email
> if [ $FAILURES -gt 100 ] ; then
> mail -s "TOO MANY MAIL SYSTEM FAILURES"
> [email protected]<mailto:[email protected]> << -EOL
> There have been $FAILURES failed message attempts so far today.
> Please check the server ASAP to prevent blacklistings
> -EOL
> fi
> # Done.
> I hope you find it useful...
>
Many thanks Dan. Great script