|Previous||Table of Contents||Next|
You can print the contents of the queue by specifying the -bp flag to sendmail. Type /usr/lib/sendmail -bp | more and then press Return. A list of the queue IDs, the size of the message, the date the message entered the queue, the message status, and the sender and recipients are displayed. You can also type mailq and then press Return to print the contents of the mail queue.
The sendmail program stores temporary queue files in /var/spool/mqueue. All such queue files have the form xfAA99999, where AA99999 is the ID for the file and x is the type. Table 3-2 shows the types of queue files.
|d||A data file. The message body (excluding the header) is kept in this file.|
|l||A lock file. If this file is present, the job is currently being processed, and running the queue will not process it. For this reason, an extraneous lock file can make a job seem to disappear.|
|n||This separate file is created whenever an ID is created. It ensures that no mail can ever be destroyed because of a race condition. This file should not exist for more than a few milliseconds at any given time.|
|q||The queue control file. This file contains the information needed to process the job.|
|t||A temporary file. This file is an image of the qf file when it is being rebuilt. When the rebuild is complete, the file is renamed qf.|
|x||A transcript file that exists during the life of a session and shows everything that happens during that session.|
The qf file contains a series of lines, each beginning with a code letter, as shown in Table 3-3. See Chapter 4 for more information about qf file codes.
|P||The current message priority, which is used to order the queue. The higher the number, the lower the priority. The priority increases as the message sits in the queue. The initial priority depends on the message class and the size of the message.|
|T||The job creation/submission time in seconds, which is used to compute when the job times out.|
|D||The name of the data file.|
|M||A message. This line, which is printed by using sendmail with the -bp flag, is generally used to store status information. It can contain any text.|
|S||The sender name.|
|E||Error recipient name. Error messages are sent to this user instead of to the sender. This line is optional.|
|H||A header definition. There may be any number of these lines. The order is important: It represents the order in the final message. The syntax is the same as in the header definitions in the configuration file.|
|R||A recipient name. There is one line for each recipient. The recipient name normally is completely aliased, but it is actually re-aliased when the job is processed. The recipient name must be at the end of the qf file.|
The queue is automatically run at the interval specified in the sendmail.cf file. (The default is every hour.) The queue is read and sorted by message priority, and then sendmail tries to process all jobs in order. The sendmail program first checks to see if a job is locked. If locked, it skips the job; if not locked, sendmail processes it.
If a major host goes down for several days, the queue may become prohibitively large, and sendmail will spend lots of time sorting the queue. You can fix this by moving the queue to a temporary place and creating a new queue. You can run the old queue later, when the host is returned to service.
Follow these steps to force the queue to process mail in the queue now:
Follow these steps to run the old mail queue:
You can run a subset of the queue at any time with the -Rstring option (run queue where any recipient name matches string) or with the -Mnnnnn option to sendmail. (Run just one message with queue ID nnnnn.)
To run a subset of the mail queue, type /usr/lib/sendmail -Rstring and then press Return. In this example, everything in the queue for recipient wnj is processed:
oak% /usr/lib/sendmail -Rwnj
|Previous||Table of Contents||Next|