QTOOL(8)
π QTOOL β the qtool(8) glow-up π
okay bestie, so you know that section 8 of the System Manager's Manual? yeah. we're doing qtool. it's giving queue herding and honestly it ate.
β¨ NAME β¨
qtool β manipulate sendmail queues π
πΈ SYNOPSIS πΈ
qtool.pl [options] target_directory source [source ...]
qtool.pl [-Q][-d|-b] [options] source [source ...]
π DESCRIPTION π
So Qtool moves the queue files that sendmail uses, from one queue to another. it uses the same locking mechanism as sendmail, so you can lowkey run it while sendmail is running and nothing bad happens. π«Ά
but babe. listen. it should not be used when queue groups have been configured to move queue files into directories they don't belong in, according to the queue group selections made in the sendmail.cf file. unless you are absolutely sure you're not interfering with the queue group selection mechanism, do not move queue files around. periodt.
With no options, qtool will move any queue files as specified by source into target_directory. and source can be literally any of these three things:
- an individual queue control file
- a queue file id
- a queue directory
If the -d option is specified, qtool will delete the messages specified by source instead of moving them. π
If the -b option is specified, the selected messages get bounced by running sendmail with the -OTimeout.queuereturn=now option. π
β¨ Options β¨
-bβ Bounce all of the messages specified by source. the messages get bounced immediately. no attempt will be made to deliver the messages. no thoughts, head empty, straight to the bounce bin. π-Cconfigfile β Specify the sendmail config file. defaults to/etc/mail/sendmail.cf. π-dβ Delete all of the messages specified by source. ποΈ-eperl_expression β Evaluate perl_expression for each queue file as specified by source. if perl_expression evaluates to true, then that queue file is moved. see below for more detail on perl_expression. π§-Qβ Operate on quarantined items (queue control file begins withhfinstead ofqf). quarantine era, we love a little isolation moment. π-sseconds β Move only the queue files specified by source that have a modification time older than seconds. β³
π¦ Perl Expressions π¦
okay this is the fun part. you can use any valid perl expression. inside the expression you have access to a hash that contains many of the fields in the control file, plus some other data about that queued message. that hash is called %msg. π
if a field has multiple values (e.g. 'Recipient'), it will be returned as an array, otherwise it will be returned as a scalar. slay.
Through %msg, you can access the following variables:
authβAUTH=parameter.body_typeβ Body type (8BITMIME,7BIT, or undefined).body_last_mod_timeβ The last time the body was modified since the epoch in seconds.body_sizeβ The size of the body file in bytes.content-lengthβContent-Length:header value (Solaris sendmail only).controlling_userβ The controlling user.control_last_mod_timeβ The last time the control file was modified since the epoch in seconds.control_sizeβ The size of the control file in bytes.creation_timeβ The time when the control file was created.data_file_nameβ The data file name (deprecated). β οΈdeliver_byβ Deliver by flag and deadline forDELIVERBYESMTP extension.envidβ Original envelope id form ESMTP.error_recipientβ The error recipient (deprecated). β οΈfinal_recipientβ Final recipient (for DSNs).flagsβ Array of characters that can be the following values:wβ warning message has been sentrβ This is an error response or DSN8β has 8 bit data in bodybβ deleteBcc:headersdβ envelope has DSNRET=parameternβ don't return body
headersβ This is a Perl hash where the keys are rfc822 field names and the values are rfc822 field values. If a field has only one value it will be returned as a string. If a field has more than one value (e.g.'Received') it will be returned as a list of strings.inode_numberβ The inode number for the data (body) file.next_delivery_timeβ Earliest time of next delivery attempt.num_delivery_attemptsβ Number of delivery attempts that have been made.macroβ Defined macro.messageβ Envelope status message.original_recipientβ Original recipient (ORCPT=parameter).priorityβ Adjusted priority of message.quarantine_reasonβ Quarantine reason for quarantined (held) envelopes.recipientβ Array of character flags followed by colon and recipient name. Flags:Nβ HasNOTIFY=parameter.Sβ Success DSN requested.Fβ Failure DSN requested.Dβ Delay DSN requested.Pβ Primary address (not the result of alias/forward expansion).
senderβ Senderversionβ Version of control file.
π₯ EXAMPLES π₯
okay here's the vibe check, bestie. look at these:
qtool.pl q2 q1
Moves all of the queue files in queue q1 to queue q2.
qtool.pl q2 q1/d6CLQh100847
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
qtool.pl q2 q1/qfd6CLQh100847
Moves the message with id d6CLQh100847 in queue q1 to queue q2.
qtool.pl -e '$msg{num_delivery_attempts} == 3' /q2 /q1
Moves all of the queue files that have had three attempted deliveries from queue q1 to queue q2. iconique.
π BUGS π
In sendmail 8.12, it is possible for a message's queue and data files (df) to be stored in different queues. π in this situation, you must give qtool the pathname of the queue file, not of the data file (df).
To be safe, never feedqtoolthe pathname of a data file (df). fr fr. do not do it.
π SEE ALSO π
πΈ HISTORY πΈ
The qtool command appeared in sendmail 8.10. β¨
aaaand that's the whole page, bestie. π«Ά this little masterpiece is dated $Date: 2013-11-22 20:51:18 $ and it lives in the System Manager's Manual as QTOOL(8) β mwah, iconic, no notes. π
π
π¦ where this page comes from
- ubuntu jammy: sendmail-base 8.15.2-22ubuntu3 Β· other-Sendmail
- Copyright (c) 1999, 2001-2002 Proofpoint, Inc. and its suppliers
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms