Sendmail Queue lenghts

William Burns William.Burns at AEROFLEX.COM
Mon Nov 14 14:20:54 GMT 2005


    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Ugo:

Here's what I use.

This script takes two parameters. The first (result1) is the name of a 
file into which queue information gets dumped.
The second (result2) is the name of a file which gets a list of all but 
40 of the queue entries that are older than 2 minutes.

My alarm threshold is "If there is a 41st queue entry that's older than 
2 minutes". So, if the result2 file ends up being non-empty, then I mail 
myself a copy of the result1 file.

-Bill

I schedule the monitorqueue script to run every 15 minutes.

> #!/bin/sh
>
> result1=$1
> result2=$2
>
> ls -l --sort=time --full-time /var/spool/mqueue/|\
> tail +2 |\
> (cut --bytes=43-;echo `date '+%a %b %d %X %Y' --date '2 minutes ago'` 
> "---------
> -" )|\
> sort -r > $result2
> (echo junk;cat $result2)|sed '1,/----------/d'|\
> tail +41 > $result1
>
> (echo junk;cat $result2)|sed '1,/----------/d'|\
> (echo "number of files older than 2 minutes:" `wc -l`) >> $result2
> (cd /var/spool/mqueue
> cat /dev/null|\
> grep --with-filename "^HTo" `fuser qf* 2>/dev/null|sed 's/:.*//'`
> ls -ld `fuser qf* 2>/dev/null|sed 's/:.*//;s/qf/\?f/'`) >> $result2 2>&1



Ugo Bellavance wrote:

> Hi,
>
>     Anyone here has scripts for testing queue lengths 
> (incoming/outgoing) with sendmail?

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list