oqmgr Command in Linux



The oqmgr, an old Postfix queue manager, is a Linux daemon that manages the mail queue. It primarily schedules messages, manages deferred messages, and handles delivery retries.

The oqmgr daemon handles incoming mail and organizes its delivery through Postfix processes, relying on the trivial-rewrite for routing. It runs under the master process and discards mail sent to the local double-bounce address to prevent bounce notification loops.

Table of Contents

Here is a comprehensive guide to the options available with the oqmgr command −

Note − In modern versions of Postfix, oqmgr has been replaced by the new queue manager called qmgr, which offers better performance and efficiency.

Syntax of oqmgr Daemon

Note that the oqmgr daemon is designed to be managed by the Postfix master process and is not typically invoked directly. However, it can accept generic Postfix daemon options when run manually or for testing purposes.

oqmgr [options]

The [options] field in the above syntax is used to specify generic Postfix options.

oqmgr Daemon Options

As discussed earlier, the oqmgr command works automatically through the Postfix master process. However, various Postfix options can be used with oqmgr for debugging. Some commonly used options are listed below −

Options Description
-c Use custom Postfix configuration file
-D Enable debug mode
-v Give verbose output

Examples of oqmgr Daemon in Linux

This section demonstrates the usage of oqmgr daemon for troubleshooting and debugging in Linux −

Using Custom Configuration File

To use a custom Postfix configuration file, use the -c option −

sudo oqmgr -c /home/user/custom.conf

Enabling Debug Mode

To enable the debug mode, use the -D option −

sudo oqmgr -D

Queues Maintained by oqmgr Daemon

The oqmgr daemon maintains the following queues −

Queues Description
Incoming Newly arrived mail, either from the network or local agents.
Active Limited set of messages actively being delivered.
Deferred Messages awaiting retries after failed delivery
Corrupt Damaged or unreadable queue files.
Hold Messages on hold, awaiting manual release.

Delivery Statuses Tracking and Delivery Strategies of oqmgr Daemon

The oqmgr tracks per-message delivery status reports from bounce, defer, and trace daemons. Moreover, it has various strategies to handle queue file access (input) and manage message delivery (output).

Strategies Description
Leaky Bucket Limits the number of active messages to avoid resource overload
Fairness Balances delivery between new and deferred messages
Slow Start Gradually increase delivery attempts to prevent overloading systems
Round Robin Ensures balanced delivery across destinations
Exponential Backoff Retries failed messages with increasingly longer intervals
Destination Status Cache Avoids redundant delivery attempts to unreachable addresses.

Triggers of oqmgr Daemon

When the system is idle, the oqmgr either waits for trigger events or a timer to expire. Triggers, which are one-byte messages, prompt the queue manager to take specific actions based on the type of message received. Those actions are listed below −

Trigger Description
D (QMGR_REQ_SCAN_DEFERRED) Starts or restarts a deferred queue scan
I (QMGR_REQ_SCAN_INCOMING) Starts or restarts an incoming queue scan
A (QMGR_REQ_SCAN_ALL) Ignores deferred queue timestamps for the next scan
F (QMGR_REQ_FLUSH_DEAD) Clears data on dead transports and destinations
W (TRIGGER_REQ_WAKEUP) Initiates an incoming queue scan, ensuring servers remain active

Note that these triggers are used internally by Postfix to control queue management dynamically.

Deprecation of oqmgr and Recommendations

The oqmgr was used in earlier versions of Postfix to manage the mail queue. However, due to performance limitations and inefficiencies, it was replaced by qmgr, starting with Postfix version 2.0. The oqmgr or qmgr are both managed by the Postfix master process. To check whether qmgr is working, check the status of Postfix.

sudo systemctl status postfix
oqmgr Command in Linux1

To specifically locate the qmgr daemon use the following command −

ps aux | grep qmgr
oqmgr Command in Linux2

To check the PID of qmgr, use −

pgrep qmgr
oqmgr Command in Linux3

To check the queue manager log, use the following command −

tail -f /var/log/mail.log
oqmgr Command in Linux4

To check the mail queue list, use the command given below −

postqueue -p

The various messages maintained by the qmgr are present in the /var/spool/postfix directory.

ls /var/spool/postfix
oqmgr Command in Linux5

Conclusion

The oqmgr daemon in Postfix managed the mail queue in earlier versions of the software, handling tasks like scheduling messages, managing deferred deliveries, and ensuring efficient routing through Postfix processes. However, due to performance and efficiency concerns, oqmgr was replaced by qmgr in Postfix 2.0.

The transition to qmgr offers better performance, with improved handling of mail queues and system resources.

This tutorial covered the oqmgr daemon, its syntax, options, and various operations it performs to manage the Postfix messages queue.

Advertisements