Printing the Queue

When sendmail is run under the name mailq, or when it is given the -bp command-line switch, it prints the contents of the queue and exits.

Before printing the queue’s contents, sendmail prereads all the qf files in the queue and sorts the mail messages internally. This is done so that the queue’s contents are displayed in the same order in which the messages will be processed during a queue run.

If there are no messages in the queue (no qf files), sendmail prints the following message and exits or, if there are multiple queues, goes on to the next queue:

/path is empty

Here, /path is the full pathname of the queue directory.

If the queue is not empty, sendmail prints the number of messages (number of qf files) in the queue:

/path (num requests)

The num is the number of queued messages (requests) in the queue directory. If this is more than the maximum number of messages that can be processed at one time (defined by the MaxQueueRunSize option (MaxQueueRunSize),[9] sendmail prints:

/path (num requests, only ## printed)

The ## is the value of the MaxQueueRunSize option.

Note that it can take several minutes to presort and print extremely full queues (queues with more than 10,000 messages in them). To see how many messages are queued, and to avoid the delay of a presort, you can add a small MaxQueueRunSize to your invocation of mailq:

% mailq -OMaxQueueRunSize=1

This will cause sendmail to swiftly print the number of queued messages, regardless of how many are queued. ...

Get Sendmail, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.