Loading ...
Sorry, an error occurred while loading the content.

Re: counting the mail in queue

Expand Messages
  • Justin Krejci
    ... I have no idea what exim -bpc outputs but for rough counts you can use something like this. We also have variable versions of this to make it more terse
    Message 1 of 3 , Mar 1 3:11 AM
    • 0 Attachment
      On Tuesday 28 February 2006 09:47 am, Sujit Choudhury wrote:
      > Hi Everybody,
      > We are sometimes getting mail loop and would very much like to find out
      > how many mails are in the queue.
      > As it is if 80,000 mails are in the queue mailq|wc -l takes very long
      > time. Is there any command like exim's exim -bpc which would report the
      > number of mails in the queue very quickly?
      >

      I have no idea what "exim -bpc" outputs but for rough counts you can use
      something like this.
      We also have variable versions of this to make it more terse or auto refresh
      after X seconds and things like that. Obviously on mail systems with large
      amounts of emails you are more prone to have messages moved from one queue to
      another by the time your "find" command gets to the other queue so a file
      might be counted twice or not counted at all. Run the script a couple of
      times, if the $total number turns out to be close each time then it is likely
      fairly accurate.

      in=`/usr/bin/find /var/spool/postfix/incoming/ -type f |/usr/bin/wc -l`
      active=`/usr/bin/find /var/spool/postfix/active/ -type f |/usr/bin/wc -l`
      deferred=`/usr/bin/find /var/spool/postfix/deferred/ -type f |/usr/bin/wc -l`
      bounce=`/usr/bin/find /var/spool/postfix/bounce/ -type f |/usr/bin/wc -l`

      total=`echo $active + $in + $deferred + $bounce |bc`
      echo "Postfix Incoming: $in"
      echo "Postfix Active: $active"
      echo "Postfix Deferred: $deferred"
      echo "Postfix Bounce: $bounce"
      echo "Total Queue: $total"
    Your message has been successfully submitted and would be delivered to recipients shortly.