16.6 Looking at the Mail Queue with qmail-qread

It's not a bad idea to look at the contents of your mail queue every week or two just to see if there's anything strange. The two utility programs to do that are qmail-qstat and qmail-qread.

For a two-line summary of your queue, run qmail-qstat as the super-user:

messages in queue: 21 messages in queue but not yet preprocessed: 0

The first line is the number of messages that have been queued but not delivered yet. On most systems the number should be small, less than a hundred. If your system hosts mailing lists, the number of messages can reasonably be larger because each list message stays in the queue until every recipient address is either delivered or bounces, and on any list of significant size, there will be a few addresses that have gone bad but take a long time to bounce.

The number of messages not preprocessed should always be zero or close to it. If you have many messages waiting to be preprocessed, it means that qmail can't deliver the mail as fast as it's arriving. If you have a very large mail system you may need to install one of the big-todo patches discussed earlier in this chapter. If not, you should look at the queue in more detail and see what's clogging it up. There's no convenient tool to look at the waiting messages, but if you simply look at the files in queue/todo with more, you can easily make out the envelope information for each message. The text of the message is stored in a file in a subdirectory of mess with the same filename as the todo file. To find the message that goes with todo/123456, the easiest approach is more mess/*/123456. Don't change or delete files in any of the queue directories while qmail is running, because qmail-send does not expect to have files changed or deleted while it's running.

To look at the messages in the queue, run qmail-qread, also as super-user. If you don't use mailing lists, its report will probably be quite short, while if you do use lists, it can be enormous. On the host I use for individual user mail, its output is about 50 lines, while on the mailing list host, its output is over 29,000 lines, because the qread output contains a line for every recipient of every message including the ones that have already been delivered, which with mailing lists can add up fast.

30 Dec 2003 20:49:34 GMT  #1222959  2113  <mary@example.com>    done  remote  aaron@myvirt.com         remote  zelda@somewhere.aq 4 Jan 2004 04:18:44 GMT  #1223051  11419  <>          remote  user1@bogus.com

In this qread output, the first message from mary@example.com has been delivered to aaron@myvirt.com, but not yet to zelda@somewhere.aq. The second message, which is a bounce because it has a null sender, has not yet been delivered to user1@bogus.com. Deliveries to local recipients say local rather than remote. If some of the deliveries have failed, the report will say bouncing. The number after the # sign in each report is the message number in the queue, so you can find the file for the second message with more mess/*/1223051. The number after the message number is the size of the message in bytes.

When looking at the queue content for hosts with mailing lists, it is useful to leave out the addresses that are done:

# /var/qmail/bin/qmail-qread | grep -v 'done'

On my list host, that gets the report down from 29,000 lines to 1500.

The results of qread are rarely very interesting, but when they are, if say you see a whole lot of large messages queued to addresses that you don't recognize, they can be the key to tracking down otherwise hard to detect problems.



qmail
qmail
ISBN: 1565926285
EAN: 2147483647
Year: 2006
Pages: 152

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net