usage: postq queue [-h] [-o time [time ...]] [-s sender] [-r recipient] [-g {sender,rcpt}] [-i filename] [-p] [-e]
positional arguments:
queue Select a queue
optional arguments:
-h, --help show this help message and exit
-o time [time ...], --older time [time ...] Valid format is: d|h|m|s
-s sender, --sender sender
-r recipient, --rcpt recipient
-g {sender,rcpt}, --group {sender,rcpt}
-f filename, --filename filename Read postqueue output from file
-p, --print Print IDs instead
-e, --errors Show error messages
I was pretty much annoyed to create ridiculous chains of grep and awk commands over and over again. So I decided to build this script, where I can easily find the IDs I am looking for.
postq can group its output by sender and rcpt, give you the error messages and return IDs as stdin for postsuper.
--rcptand--senderhas full regex support--groupalways defaults to sender
--older arguments are more or less like those passed to date -d in a shorter notation:
- Todo: passing a datetime
postq all --older 3d 2h 11m
postq all -f postqueue.example
[email protected]
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
------------------------------
MAILER-DAEMON
7C0C313C0C7 - Mon Jan 26 05:56:53
[email protected]
------------------------------
[email protected]
9C2AB13C0BE - Fri Jan 30 14:52:13
[email protected]
E7688DE3FA - Wed Feb 11 15:31:03
[email protected], [email protected]
------------------------------
[email protected]
DD6C66A8064 - Mon Dec 1 17:18:29
[email protected], [email protected], [email protected]
------------------------------
- Todo: regex matching
[email protected]
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
(connect to mx.random.net[999.888.777.666]:25: Connection timed out)
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
(connect to mx2.random.net[888.721.412.123]:25: Connection timed out)
------------------------------
MAILER-DAEMON
7C0C313C0C7 - Mon Jan 26 05:56:53
[email protected]
(Host or domain name not found. Name service error for name=notexistant.com type=MX: Host not found, try again)
------------------------------
[email protected]
9C2AB13C0BE - Fri Jan 30 14:52:13
[email protected]
E7688DE3FA - Wed Feb 11 15:31:03
[email protected], [email protected]
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
------------------------------
[email protected]
DD6C66A8064 - Mon Dec 1 17:18:29
[email protected], [email protected], [email protected]
------------------------------
7C0C313C0C7
9C2AB13C0BE
DD6C66A8064
AFC351AC602A
E7688DE3FA
[email protected]
DD6C66A8064 - Mon Dec 1 17:18:29
[email protected]
------------------------------
[email protected]
9C2AB13C0BE - Fri Jan 30 14:52:13
[email protected]
DD6C66A8064 - Mon Dec 1 17:18:29
[email protected]
------------------------------
[email protected]
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
------------------------------
[email protected]
E7688DE3FA - Wed Feb 11 15:31:03
[email protected]
------------------------------
[email protected]
DD6C66A8064 - Mon Dec 1 17:18:29
[email protected]
------------------------------
[email protected]
E7688DE3FA - Wed Feb 11 15:31:03
[email protected]
------------------------------
[email protected]
7C0C313C0C7 - Mon Jan 26 05:56:53
MAILER-DAEMON
------------------------------
[email protected]
AFC351AC602A - Mon Feb 16 07:05:26
[email protected]
------------------------------