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;








9















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.










share|improve this question






























    9















    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.










    share|improve this question


























      9












      9








      9


      3






      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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




















          5 Answers
          5






          active

          oldest

          votes


















          18














          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.






          share|improve this answer

























          • 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


















          16














          either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l



          both works






          share|improve this answer




















          • 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


















          0














          Pipe the ouput to wc, if further refining is required, use grep.






          share|improve this answer






























            0














            I use



            /usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'


            seems quicker than grep but no 0 returns






            share|improve this answer






























              0














              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.






              share|improve this answer























                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
                );



                );













                draft saved

                draft discarded


















                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









                18














                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.






                share|improve this answer

























                • 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















                18














                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.






                share|improve this answer

























                • 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













                18












                18








                18







                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.






                share|improve this answer















                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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                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

















                • 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













                16














                either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l



                both works






                share|improve this answer




















                • 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















                16














                either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l



                both works






                share|improve this answer




















                • 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













                16












                16








                16







                either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l



                both works






                share|improve this answer















                either mailq | tail -n 1 or find /var/spool/postfix/deferred -type f | wc -l



                both works







                share|improve this answer














                share|improve this answer



                share|improve this answer








                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












                • 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











                0














                Pipe the ouput to wc, if further refining is required, use grep.






                share|improve this answer



























                  0














                  Pipe the ouput to wc, if further refining is required, use grep.






                  share|improve this answer

























                    0












                    0








                    0







                    Pipe the ouput to wc, if further refining is required, use grep.






                    share|improve this answer













                    Pipe the ouput to wc, if further refining is required, use grep.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 21 '13 at 10:57









                    RomanRoman

                    3,50021631




                    3,50021631





















                        0














                        I use



                        /usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'


                        seems quicker than grep but no 0 returns






                        share|improve this answer



























                          0














                          I use



                          /usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'


                          seems quicker than grep but no 0 returns






                          share|improve this answer

























                            0












                            0








                            0







                            I use



                            /usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'


                            seems quicker than grep but no 0 returns






                            share|improve this answer













                            I use



                            /usr/sbin/postqueue -p | /usr/bin/tail -n1 | /usr/bin/gawk 'print $5'


                            seems quicker than grep but no 0 returns







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Mar 23 at 11:18









                            StavrosStavros

                            1




                            1





















                                0














                                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.






                                share|improve this answer



























                                  0














                                  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.






                                  share|improve this answer

























                                    0












                                    0








                                    0







                                    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.






                                    share|improve this answer













                                    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.







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered May 27 at 23:20









                                    hiburn8hiburn8

                                    1011




                                    1011



























                                        draft saved

                                        draft discarded
















































                                        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.




                                        draft saved


                                        draft discarded














                                        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





















































                                        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







                                        Popular posts from this blog

                                        How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

                                        What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

                                        Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos