Skip to content

qscheduler.8

Manvendra Bhangui edited this page Feb 25, 2024 · 6 revisions

NAME

qscheduler - turn on mail delivery with fixed number of queues or load dependent dynamic queues

SYNOPSIS

qmail-start [ -s | -cd ] [ defaultdelivery ] [ logger arg ... ]

qscheduler [ -s | -cdn ] [ defaultdelivery ] [ logger arg ... ]

DESCRIPTION

qmail-start forks and executes todo-proc(8), qmail-lspawn(8), qmail-rspawn(8), and qmail-clean(8) as childs, for a queue defined by the environment variable QUEUEDIR. The queue can be created by queue-fix(8). Messages are injected in the queue by any qmail-queue client. See qmail-queue-clients(7). qmail-start then execs qmail-send(8). qmail-start sets up communication channels using pipes between qmail-send and the other four daemons. These five daemons cooperate to deliver messages from the queue and are executed with the proper uids and gids to achieve a security partition. The uids and gids are obtained from the passwd(5) database using standard glibc getpwent(3), getgrent(3) calls which are inherently unreliable. You can switch to internal qgetpwent(3), qgetgrent(3) functions by setting the environment variable USE_QPWGR. qmail-start should be used if you desire to run only one queue. For running multiple parallel queues use qscheduler. The uids and gids with which these give daemons are invoked are as follows. If USE_SETGROUPS environment variable is set, qmail-start sets up additional groups.

daemon UNIX user UNIX group
qmail-send qmails qmail
todo-proc qmails qmail
qmail-clean qmailq qmail + supplementary groups for qmailq
qmail-lspawn root qmail
qmail-rspawn qmailr qmail + supplementary groups for qmailr
logger qmaill nofiles + supplementary groups for qmaill

qscheduler invokes multiple invocations of qmail-start to invoke qmail-send, todo-proc, qmail-lspawn, qmail-rspawn, and qmail-clean, under the proper uids and gids for multiple queues. Each instance refers to a specific queue. The number of instances can be fixed (-s) or dynamic (-d). When using static queues, the number of queues is fixed at runtime.

Using the program qmonitor(8), queue loads can be communicated to qscheduler using qscheduler message queue. When using dynamic queues, the number of queues can be increased or decreased at runtime depending on the queue load. The queue load is an indicator of the average concurrency of all queues. When it reaches MAX_LOAD environment variable for both the local queue or the remote queue for all the queues (default compile time value=90 for each queue), qscheduler configures an additional queue using queue-fix(8) and invokes qmail-send, todo-proc, qmail-lspawn, qmail-rspawn and qmail-clean on the new queue. qscheduler uses 151 as the default split value. This can be changed by setting the CONFSPLIT environment variable. Additionally qscheduler can process a queue created with todo, intd with subdirectory split instead of without any split. This can be done by setting the BIGTODO environment variable. If the -n option is provided, queue counts will not be increased or decreased.

qscheduler also monitors each todo-proc, qmail-send instances and restarts them if they go down.

qmail-start or qscheduler arranges for qmail-send's activity record to be sent to qmail-start's output. See qmail-log(5) for the format of the activity record. qmail-start doesn't print anything other than errors on descriptor 2 before it execs qmail-send. qscheduler announces its startup, exit and failures on descriptor 1 and descriptor 2. qscheduler sets the environment variable QIDENT, before invoking qmail-start. QIDENT is the queue directory number and this is used by qmail-send to append the QIDENT number to the delivery number in the logs, facilitating processing of logs by matchup(1).

Resource limits, controlling ttys, et al. are also passed from qmail-start or qscheduler to qmail-local.

Note that qmail-send normally juggles several simultaneous deliveries. To reduce qmail-send's impact on other programs, you can run qmail-start or qscheduler with a low priority.

OPTIONS

-s
This implies qscheduler will have a fixed number of qmail-start invocations. The number of todo-proc, qmail-send instance it runs is defined by the environment variable QUEUE_COUNT. For each instance of qmail-start, the queue is defined by qscheduler by setting the environment variable QUEUEDIR. A queue is defined by the integers defined by environment variables QUEUE_START and QUEUE_COUNT.

Setting QUEUE_COUNT=2, QUEUE_START=1 will make qscheduler run qmail-start twice. The first invocation of qmail-start will use the queue /var/indimail/queue/queue1 and the second instance will use /var/indimail/queue/queue2. This will cause two copies of todo-proc, qmail-send, qmail-lspawn, qmail-rspawn, qmail-clean to run

-d
This implements dynamic queues and uses POSIX IPC for communcation between qscheduler(8), qmail-send(8), todo-proc(8), qmail-queue(8), qmail-multi(8). See multi-queue(7) for a complete overview.

-c
When using dynamic queues, this enables compatability mode with the traditional method of using the lock/trigger fifo in the queue directory. This allows qmail-queue running in non-dynamic mode to trigger scan of the todo directory by todo-proc. Use this when your system has qmail, netqmail or old qmail-queue clients injecting emails. Using compatability mode doesn't give you the full performance benefits when system is configured to use POSIX IPC for dynamic queues.

-n
When using dynamic queues, this keeps original queue counts. The queue counts are neither decreased or increased.

defaultdelivery
If defaultdelivery is supplied, qmail-start or qscheduler passes it to qmail-lspawn.

The default indimail installation, creates a supervised service in @servicedir@/deliver.25. The output goes to @logdir@/slowq/current. The default mailbox type is picked up from the defaultdelivery control file. The table below outlines the choices for defaultdelivery control file

Mailbox Name Location defaultdelivery Comments
Format
_
mbox Mailbox $HOME ./Mailbox most common, works with
maildir Maildir $HOME ./Maildir/ more reliable, less
mbox username /var/spool/mail See INSTALL.vsm traditional mailbox
_

logger
If logger is supplied, qmail-start or qscheduler invokes *logger with the given arguments, and feeds *qmail-send's activity record through logger.

Environment variables given to qmail-start or qscheduler will eventually be passed on to qmail-local, so make sure to clean up the environment if you run qmail-start manually:

   # env - PATH="PREFIX/sbin:$PATH"


   qmail-start ./Mailbox splogger qmail &


   (all on one line)

CONTROL FILES

msgqueuelen
The maximum message queue length of POSIX message queue /queueN, where N is the queue number of the queue.

msgqueuesize
The maximum message size of POSIX message queue /queueN, where N is the queue number of the queue

Supplementary Groups

If you set the environment variable USE_SETGROUPS, qmail-start can set supplementary groups (if defined in /etc/group) for qmail-send (for qmails user), qmail-rspawn (for qmailr user), qmail-clean (qmailq user) and any logger specified on command line (qmaill user). See group(5) to learn how to set supplementary groups.

SEE ALSO

qmonitor(1) logger(1) splogger(1) nice(1) qtop(1), qmail-log(5), qmail-local(8), qmail-clean(8), qmail-lspawn(8), qmail-rspawn(8), qmail-send(8), todo-proc(8), qmail-multi(8), queue-fix(8), setqload(8), initsvc(1), svscan(8), supervise(8), getpwent(3) getgrent(3) qgetpwent(3), qgetgrent(3), passwd(5) group(5) shm_open(3) mq_open(3) ipcs(1) mq_overview(7) multi-queue(7), IndiMail(7)

Clone this wiki locally