[Mimedefang] OT: Configure sendmail queue runner.

Lucas Albers admin at cs.montana.edu
Thu Dec 18 13:53:29 EST 2003


Queue Running
How to split mail with sendmail into queues...
And how to configure multiple queue runners to speed up sendmail.
(Correct me on queue runners part as it is extrapolation on my part.)

The default sendmail queue runner (8.12.x) runs once every 5 minutes.
You can set the how often a queue runner runs based on the sender or
recipient. So you can for example have a really fast processing queue that
handles local domain senders or recipients faster then outgoing mail.
Boom Boom Boom, like such:
Examples of running queue runner:
#runs Recipient from localhost once a second
sendmail -L sm-msp-queue -Ac -q1s -qRlocalhost
#runs Sender from localhost once a second
sendmail -L sm-msp-queue -Ac -q1s -qRlocalhost
#runs Sender/Recipient for domain every 5 seconds
sendmail -L sm-msp-queue -Ac -q30s -qScoe.montana.edu
sendmail -L sm-msp-queue -Ac -q30s -qRcoe.montana.edu
sendmail -L sm-msp-queue -Ac -q1m -qSmontana.edu
sendmail -L sm-msp-queue -Ac -q1m -qRmontana.edu

I have queue runners that run slower queue runs the for the larger
dowmains...


Pure extrapolation on my part, but it seems to speed up if you multiple
mail queue on the same mail queue as the queues will both take up handling
mail messages.
#example of running a slower failed delivery queue and writing the pid
file to a file, once every 30 minutes.
sendmail -L sm-slowq -Ac -q30m -O PidFile=/var/run/sm-slowq.pid -O
QueueDirectory=/var/spool/slow-mqueue

To use a slower queue for problematic hosts you need thus:
A script to moved failed delivery mail to a queue that runs slower.
Run however often you want from cron.
#!/bin/sh
# slowqueue.sh
# Originally by Dave Skoll
# Move messages with more than 2 retransmission attempts to slow queue
SLOWQUEUE=/var/spool/slow-mqueue
QUEUE=/var/spool/mqueue
/usr/local/bin/qtool.pl -e '$msg{num_delivery_attempts} >= 3' $SLOWQUEUE
$QUEUE


So make the slow mail queue
permissions are:
drwxrwx--- smmsp.smmsp /var/spool/slow-mqueue/

#set the permissions on the pid.
chown smmsp.smmsp /var/run/sm-slowq.pid
#start queue runner to run every 10m, sort by host,so it can do numerous
#recipients to same host at once.
sendmail -L sm-slowq -Ac -q10m -O PidFile=/var/run/sm-slowq.pid -O
QueueDirectory=/var/spool/slow-mqueue/ -O QueueSortOrder=host


Once you set the permissions on the queue directory correctly, the queue
runner should run, look at your logs to verify.
...for me...it is running correctly, and processing messages.

You could also sort mail with the following extra criteria if you want to
process bounce message:

#this will just handle failed delivery bounce attempts in a slow alternate
queue.
#11/12/2003 by rpuhek AAAAT etnsystems.com
qtool.pl -e '$msg{num_delivery_attempts} >= 3 && ($msg{sender} =~ "\<\>"
or $msg{sender} =~ "MAILER-DAEMON")' /var/spool/mqueue-slow-retry
/var/spool/mqueue/Q*

To list the contents of your queue do thus:
mailq -O QueueDirectory=/var/spool/slow-mqueue/

Or to force a run of your queue do thus:
sendmail -q -v -O QueueDirectory=/var/spool/slow-mqueue/

I have not determined how to set the queue name correctly, sendmail has an
option -qG in which you define the queue-name that you wish to process but
I do not believe I am defining the queue name on my queue processing
runner correctly, so I cannot do a run based on the queue name.


If you have any additional information or wish to correct any errors, let
me know.

I am putting this on a webpage for reference, as soon as I get feedback.
--Luke



More information about the MIMEDefang mailing list