MAILQ(1)

NAME
mailq - zmailer mail queue printer

SYNOPSIS
mailq [ -i ] [ -p port_or_socket_path ] [ -s[s] ] [ -t ] [ -u user ] [ -v[v] ] [ -d ] [ -S ] [ -Q ] [ host ]

DESCRIPTION
mailq queries a running scheduler process on a specified host for its current internal model of the mail transport queues and presents this information to the user. By default, the scheduler process queried is the one relevant to the local host, i.e. either a local process or a scheduler on a mail server host. If the optional host argument is specified, the scheduler running on that host will be queried instead.

If the scheduler has used -Q option to shrink the amount of output, the mailq must also use -Q option to report about the queue status at the server in ``queue-summary'' format.

The information printed for each queued message is labelled by its message file id, which is the name of the original message file in the POSTOFFICE/queue directory and of the message control file in the POSTOFFICE/transport directory. The information may be different for different channel/host combinations in destination addresses in a single message, so the status information is grouped in clusters labelled by the channel and host for addresses in the group.

The text associated with a particular deferred destination in a message originates in a transport agent. The scheduler annotates the transport agent messages with retry information when an address has been scheduled for later delivery attempts, or with text stating why a retry that should have happened was delayed. A lack of annotations indicates a delivery attempt is in progress.

OPTIONS
The normal action is to print the transport queue.

-v  will produce verbose transport queue output in that message id's, and sender and recipient addresses, will be listed in addition to the normal status line. Doubling this option asks for extra verbose output, presently this adds the message size in bytes after the message id. This option is only useful if mailq can read the message control files in the postoffice. Most users can only see the data for their own messages.

-s  asks for a status of the router, scheduler, and transport queues. The first two are determined by scanning the appropriate directories and counting files, whereas the status of the transport queue is retrieved from the running scheduler process. Doubling this option will cause mailq to exit after printing this summary.

-S  shows summary of files queued to the channel/destination. Listed info tells the number of files, and if available, also total- and mean-size of those files.

-t  disables any previous verbose flags to produce the normal terse output.

-i  prints a verbose transport queue output (see the -v flag) for your own messages only.

-u user
    selects messages sent by the specified user id. This option is usually only useful to the Postmaster on the system.

-d  prints the information received from the scheduler as is. This will override the verbose option.

-p port
    specifies an alternate TCP/IP port to connect to a scheduler at.

-Q

-QQ Two Q:s produces an abbreviated summary, while one Q gives full report of all threads.

mailq -Q output codes
Examples of ``mailq -Q'' output:

smtp/*.com/0
    smtp/aol.com/0  R=1 A=147 P={19598} HA={571}s FA={571}s OF=1 S={STUFF} UF=0 QA=1d18h
    smtp/some.com/0 R=1 A=58 W=1860s QA=11h11m28s
        Threads: 11 Msgs: 36 Procs: 23 Idle: 12 Plim:90 Flim: 150 Tlim: 1
Kids: 414 Idle: 324 Msgs: 754 Thrds: 129 Rcpnts: 943 Uptime: 1d31m22s
Msgs in 5384 out 4630 stored 754 Rcpnts in 441890 out 440917 stored 971

The codes mean following:

R=  Number of messages on this ``channel/host'' thread; this does not count individual target users separately! (e.g. if there are a dozen recipients at some message, but they are at same host, they are counted as one.)

A=  Count of Attempts to do delivery at this thread.

P=  Process number(s) of the transport agent actively handling this thread.
    There can be multiple processes, and they are listed comma-separated inside the curly brackets. Similarly for the test of the things below.

W=  Delay time until next time the transport-agent may try to send this thread. (Wait)

HA= ``#HungerAge(s)'' -- time since the scheduler saw last ``#hungry'' message from the transport agent.

FA= ``Feed Age(s)'' -- time since the scheduler did last time feed something to the transport agent(s).

OF= ``OverFeed count'' -- how many unacknowledged tasks are still in the transport agent(s) for this thread. The ``OverFeed'' was created to handle sluggish scheduler in hard pressed system to get jobs scheduled around, when the transport agents were in practice running dry as they did their jobs fast, but the scheduler didn't get around to feed them... Thus the way for the scheduler to ``overfeed'' as many of the jobs in active thread to the transport agent as possible, and then just wait them to complete, and be acknowledged. With this a lot more gets done even with a sluggish scheduler.

S=  Feed-State of TA-process(es) doing actual job. The scheme goes like following:

    LARVA
        (This is very fast transient state.) TA processes are created at this state, and they stay there only until the first ``#hungry'' message is heard, then one job if fed there, and state is changed to ``STUFFing.'' (One job so that if it fails, TA process kicks to other thread.)

    STUFFing
        This is normal lifetime state of a TA process. When process' UF= count goes to zero, more jobs are fed to it. A process moves away from this state by either:

        - getting a #retryat message
            Next state is FINISHing.

        - running out of jobs to feed
            Next state is FINISHing -- this requires that no messages were available for feeding at the time. If even single one is fed, state stays in STUFFing.

    FINISHing
        This waits for the OF= count to go to zero, and then it tries to pick a new thread for the process to work on (if available), or if none can be found, moves the process to IDLE state. If a new thread is found for processing, process moves there, and goes to STUFFing state.

    IDLE
        (This is very fast transient state.) The TA process is being idled, next state for the process will be in thread-group idle-pool.

UF= How many messages out of all present in the queue have not yet been fed to the current TA process set ? ("UnFed count")

QA= Age of oldest message in the queue at this thread. ("QueueAge")

BUGS
MAILQ-V2 isn't described yet (nor is that protocol implementation complete)

FILES
/etc/zmailer.conf
/var/spool/postoffice/transport (POSTOFFICE/transport)
/var/spool/postoffice/queue (POSTOFFICE/queue)

SEE ALSO
zmailer(1), router(8), scheduler(8)

AUTHOR
This program authored and copyright by:
Rayan Zachariassen <rayan@cs.toronto.edu>
Partial rewrite for ZMailer 2.99/3.0 by:
Matti Aarnio <mea@nic.funet.fi>