postsuper Command in Linux



The postsuper command in Linux manages the Postfix mail queue. This command is called postsuper because it is restricted to super users. It allows queue operations like deleting, requeuing, and repairing messages.

Table of Contents

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

Syntax of postsuper Command

The syntax of the postsuper command in Linux is as follows −

postsuper [options] [message_id]

In the above syntax, the [options] field is used to specify various options for managing the mail queue. The [message_id] is used to specify the queue ID of the email.

postsuper Command Options

The options for the Linux postsuper command are listed below −

Option Description
-c config_dir Use a specific configuration directory instead of the default configuration directory.
-d queue_id Delete a specific message from the queue. Use "-d ALL" to remove all messages.
-h queue_id Move a message to the hold queue, preventing delivery. Use "-h ALL" to hold all messages.
-H queue_id Release a held message, moving it back to the deferred queue. Use "-H ALL" to release all.
-p Purge old temporary files left after crashes.
-r queue_id Requeue a message for processing. Use "-r ALL" to requeue all messages.
-s Check and repair queue structure, useful after restoring from backup.
-v Enable verbose logging for debugging; multiple "-v" increases verbosity.

Examples postsuper Command in Linux

This section explains how to use the postsuper command in Linux with examples −

Deleting a Specific Message

Before deleting, let’s view the current mail queue using the following command −

mailq
postsuper Command in Linux1

The output of the above command also prints the queue ID which will be used to manage the mail queue.

To delete a specific message from the mail queue, use the -d option with the message ID −

sudo postsuper -d 81D9E169746
postsuper Command in Linux2

To verify, check the mail queue again.

postsuper Command in Linux3

The output image shows that the message has been deleted.

Deleting All Messages in the Queue

To delete all messages in the queue, use the ALL keyword −

sudo postsuper -d ALL
postsuper Command in Linux4

Similarly, to remove all the messages in the deferred queue, use the following command −

sudo postsuper -d deferred

In the same way, active, hold, and incoming messages can also be deleted.

Holding Messages

To send a specific message to the hold queue, use the -h option with the message ID −

sudo postsuper -h 640C51615B1

To verify, use the following command −

mailq | grep hold

Similarly, to hold all messages, use the command given below −

sudo postsuper -h ALL

Releasing Held Messages

To release a specific held message, use the -H option with a message ID −

sudo postsuper -H 640C51615B1

To release all the held messages, use the postsuper command in the following way −

sudo postsuper -H ALL

Requeuing Messages

To requeue a message with a queue ID, use the -r option with message ID −

sudo postsuper -r 640C51615B1

To requeue all messages, use the following command −

sudo postsuper -r ALL

It is important to note that the -r option requeues a message for immediate processing.

Enabling Verbose Logging

To enable the verbose logging, use the -v option −

sudo postsuper -v -d 640C51615B1

To increase the verbosity level, use the -v multiple times.

postsuper Command in Linux5

Purging Old Files

To purge the old temporary files left after a system or software crash, use the -p option −

sudo postsuper -v -v -p
postsuper Command in Linux6

The -v is used to get the detailed output in the above command.

Repairing a Queue Structure

To check and repair a queue structure, use the -s option −

sudo postsuper -v -v -s
postsuper Command in Linux7

The -s option is used to check and repair the integrity of the queue structure after a failure or crash.

Conclusion

The postsuper command in Linux is a powerful tool for managing the Postfix mail queue, offering various options for operations like deleting, requeuing, holding, and releasing messages. By using the postsuper command, administrators can maintain the mail queue, purge old files, repair queue structures, and enable detailed logging for troubleshooting. The command is meant for super users and can be adjusted to perform certain tasks on specific messages or all messages in the queue, using different options and message IDs.

Advertisements