How do I count the messages of Postfix's mailq?Email Problem - mailqMail Queue Fatal ErrorPostfix: send all bounce messages to postmasterDelete from mailq where subject matchessendmail queue - display number of messages per domainPostfix mailq - Same 8 messages repeat 15 timesmailq -Ac doesn't match number of files in clientmqueuePostfix count relayed messages per userPostfix: Send all mailq messages to a single fileRsyslog. How to count messages sent to kafka
How does AFV select the winning videos?
Part of my house is inexplicably gone
What does "lit." mean in boiling point or melting point specification?
Create a cube from identical 3D objects
Was planting UN flag on Moon ever discussed?
Was self-modifying code possible using BASIC?
Insert a smallest possible positive integer into an array of unique integers
Placement of positioning lights on A320 winglets
What's the best way to quit a job mostly because of money?
How to avoid typing 'git' at the begining of every Git command
Oil draining out shortly after turbo hose detached/broke
What is the logic behind charging tax _in the form of money_ for owning property when the property does not produce money?
How do I type a hyphen in iOS 12?
How can you estimate a spike story?
How can powerful telekinesis avoid violating Newton's 3rd Law?
Magento 2 | Is there an observable event for when the checkout begins?
How to generate list of *all* available commands and functions?
As easy as Three, Two, One... How fast can you go from Five to Four?
Why is my power MOSFET heating up when on?
Why is long-term living in Almost-Earth causing severe health problems?
When to use и or а as “and”?
How to make a composition of functions prettier?
What is this object?
Why do the TIE Fighter pilot helmets have similar ridges as the rebels?
How do I count the messages of Postfix's mailq?
Email Problem - mailqMail Queue Fatal ErrorPostfix: send all bounce messages to postmasterDelete from mailq where subject matchessendmail queue - display number of messages per domainPostfix mailq - Same 8 messages repeat 15 timesmailq -Ac doesn't match number of files in clientmqueuePostfix count relayed messages per userPostfix: Send all mailq messages to a single fileRsyslog. How to count messages sent to kafka
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
How can I get number of messages count in Postfix's mailq? mailq command display entire mails in mailq but i would like to know count only.Is there any command for this. My OS is centos 5.5.
linux centos email postfix
add a comment |
How can I get number of messages count in Postfix's mailq? mailq command display entire mails in mailq but i would like to know count only.Is there any command for this. My OS is centos 5.5.
linux centos email postfix
add a comment |
How can I get number of messages count in Postfix's mailq? mailq command display entire mails in mailq but i would like to know count only.Is there any command for this. My OS is centos 5.5.
linux centos email postfix
How can I get number of messages count in Postfix's mailq? mailq command display entire mails in mailq but i would like to know count only.Is there any command for this. My OS is centos 5.5.
linux centos email postfix
linux centos email postfix
edited Oct 31 '14 at 14:24
Community♦
1
1
asked Feb 21 '13 at 10:51
Sai Ye Yan Naing AyeSai Ye Yan Naing Aye
146116
146116
add a comment |
add a comment |
5 Answers
5
active
oldest
votes
I use this:
mailq | grep -c "^[A-F0-9]"
You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
A better regex is^[A-F0-9]which correctly results in 0 when the mail queue is empty. I've edited the answer.
– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
add a comment |
either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l
both works
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
add a comment |
Pipe the ouput to wc, if further refining is required, use grep.
add a comment |
I use
/usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'
seems quicker than grep but no 0 returns
add a comment |
I use:
mailq | grep -c "^$"
This is essentially the same as @Ladadadada's answer of:
mailq | grep -c "^[A-F0-9]"
Except I am just looking for the empty lines which follow each message entry in the mailq log, rather than something that looks like the start of a valid message-ID. It is therefore better performance-wise, although the difference is only noticeable on very a-typical mailq log sizes.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f481038%2fhow-do-i-count-the-messages-of-postfixs-mailq%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
I use this:
mailq | grep -c "^[A-F0-9]"
You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
A better regex is^[A-F0-9]which correctly results in 0 when the mail queue is empty. I've edited the answer.
– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
add a comment |
I use this:
mailq | grep -c "^[A-F0-9]"
You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
A better regex is^[A-F0-9]which correctly results in 0 when the mail queue is empty. I've edited the answer.
– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
add a comment |
I use this:
mailq | grep -c "^[A-F0-9]"
You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.
I use this:
mailq | grep -c "^[A-F0-9]"
You can pipe the output of mailq through various other filters such as uniq, sort and wc to get other statistics.
edited Oct 6 '15 at 16:24
answered Feb 21 '13 at 10:57
LadadadadaLadadadada
22.2k54981
22.2k54981
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
A better regex is^[A-F0-9]which correctly results in 0 when the mail queue is empty. I've edited the answer.
– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
add a comment |
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
A better regex is^[A-F0-9]which correctly results in 0 when the mail queue is empty. I've edited the answer.
– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
This is not accurate. When the Postfix queue is empty, then run 'mailq', we will get "Mail queue is empty" which also match "^[0-9A-Z]". And in such a situation it is not accurate.
– andy
Jul 7 '15 at 12:59
1
1
A better regex is
^[A-F0-9] which correctly results in 0 when the mail queue is empty. I've edited the answer.– Ladadadada
Oct 6 '15 at 16:26
A better regex is
^[A-F0-9] which correctly results in 0 when the mail queue is empty. I've edited the answer.– Ladadadada
Oct 6 '15 at 16:26
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
How silly, the last line of the output is the count
– Geoffrey
Jan 2 '17 at 23:37
add a comment |
either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l
both works
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
add a comment |
either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l
both works
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
add a comment |
either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l
both works
either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l
both works
edited Feb 21 '13 at 11:03
answered Feb 21 '13 at 10:58
replayreplay
2,732915
2,732915
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
add a comment |
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
1
1
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
I get "682430 Kbytes in 26472 Requests." for the first one and "23" for the second one.
– rob
Dec 18 '17 at 13:28
add a comment |
Pipe the ouput to wc, if further refining is required, use grep.
add a comment |
Pipe the ouput to wc, if further refining is required, use grep.
add a comment |
Pipe the ouput to wc, if further refining is required, use grep.
Pipe the ouput to wc, if further refining is required, use grep.
answered Feb 21 '13 at 10:57
RomanRoman
3,50021631
3,50021631
add a comment |
add a comment |
I use
/usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'
seems quicker than grep but no 0 returns
add a comment |
I use
/usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'
seems quicker than grep but no 0 returns
add a comment |
I use
/usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'
seems quicker than grep but no 0 returns
I use
/usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'
seems quicker than grep but no 0 returns
answered Mar 23 at 11:18
StavrosStavros
1
1
add a comment |
add a comment |
I use:
mailq | grep -c "^$"
This is essentially the same as @Ladadadada's answer of:
mailq | grep -c "^[A-F0-9]"
Except I am just looking for the empty lines which follow each message entry in the mailq log, rather than something that looks like the start of a valid message-ID. It is therefore better performance-wise, although the difference is only noticeable on very a-typical mailq log sizes.
add a comment |
I use:
mailq | grep -c "^$"
This is essentially the same as @Ladadadada's answer of:
mailq | grep -c "^[A-F0-9]"
Except I am just looking for the empty lines which follow each message entry in the mailq log, rather than something that looks like the start of a valid message-ID. It is therefore better performance-wise, although the difference is only noticeable on very a-typical mailq log sizes.
add a comment |
I use:
mailq | grep -c "^$"
This is essentially the same as @Ladadadada's answer of:
mailq | grep -c "^[A-F0-9]"
Except I am just looking for the empty lines which follow each message entry in the mailq log, rather than something that looks like the start of a valid message-ID. It is therefore better performance-wise, although the difference is only noticeable on very a-typical mailq log sizes.
I use:
mailq | grep -c "^$"
This is essentially the same as @Ladadadada's answer of:
mailq | grep -c "^[A-F0-9]"
Except I am just looking for the empty lines which follow each message entry in the mailq log, rather than something that looks like the start of a valid message-ID. It is therefore better performance-wise, although the difference is only noticeable on very a-typical mailq log sizes.
answered May 27 at 23:20
hiburn8hiburn8
1011
1011
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f481038%2fhow-do-i-count-the-messages-of-postfixs-mailq%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown