When sendmail first
starts, the -q command-line switch (Section 11.8.1) tells it how often to process its queues. The
form of that command-line switch looks like this:
-qinterval
The interval is an expression composed of
numbers and letters that sets the time interval between queue
processing runs. The following, for example, sets the interval to be
once every 2 hours, 13 minutes, 7 seconds:
-q2h13m7s
In typical installations, the interval is usually expressed only in
minutes:
-q15m
When sendmail first starts, it finds the
-q command-line switch, then places the interval
value into the ${queue_interval} macro. That value
is a text expression containing three positions:
hours:minutes:seconds
If the interval is longer than a day, that number of days (and
possibly weeks or months) is expressed in hours in the
hours position. If any of the three positions is
zero, it is expressed as 00. If any of the three positions has a
value less than 10, it is zero padded on the left. For example, a
-q0h9m12s would yield this value in the
${queue_interval} macro:
00:09:12
One possible use for this macro might be to cause rules to function
differently depending on whether the -q
command-line switch contains an interval. Consider, for example, the
following mc configuration file lines:
LOCAL_RULESETS
Squeuegroup
R $* $: $&{queue_interval} $| $1
R $+ : $+ : $+ $| $* $@
... select queue groups here
Here, under LOCAL_RULESETS, we declare the
queuegroup rule set (Section 11.4.5), which is used to select queue groups for
particular addresses. The first rule prefixes the workspace with the
value of the ${queue_interval} macro, and a
$| operator. The second rule checks the workspace
to the left of the $| to see if it looks like a
time expression. If it does (if sendmail was run
with a -q interval), we skip (the RHS
$@) queue group selection.
This scheme allows the same configuration file to be used for two
daemons. One will be the initial delivery daemon and will be run
without a queue interval. The other will be the queue processing
daemon and will run with a queue interval.
${queue_interval} is transient. If it is defined
in the configuration file or in the command line, that definition can
be ignored by sendmail. Note that
${queue_interval} is defined after the
configuration file is read. Therefore, although it
won't change thereafter, a $&
prefix is still necessary when you reference it in rules (that is,
use $&{queue_interval}, not
${queue_interval}).