it-swarm.cn

如何检查后缀队列大小?

相当于sendmail -bp的后缀是什么?

55
Gary Richardson

或者,减少键入:

mailq
67
womble
 qshape有效

将向您显示发送到每个域的电子邮件数量以及它们在活动队列中已经存在了多长时间

 qshape推迟了

会显示相同的内容,但延迟队列

27
Alistair Prestidge
postqueue -p
27
Andrejs Cainikovs

这是我使用的内容,是从后缀邮件列表中剔除的。我删除了作者的名字,以防他不想在这里出现(您可以在源头看到它)。它仅显示总计。

#!/usr/bin/env Perl

# postfix queue/s size
# author: 
# source: http://tech.groups.yahoo.com/group/postfix-users/message/255133

use strict;
use warnings;
use Symbol;
sub count {
        my ($dir) = @_;
        my $dh = gensym();
        my $c = 0;
        opendir($dh, $dir) or die "$0: opendir: $dir: $!\n";
        while (my $f = readdir($dh)) {
                if ($f =~ m{^[A-F0-9]{5,}$}) {
                        ++$c;
                } elsif ($f =~ m{^[A-F0-9]$}) {
                        $c += count("$dir/$f");
                }
        }
        closedir($dh) or die "closedir: $dir: $!\n";
        return $c;
}
my $qdir = `postconf -h queue_directory`;
chomp($qdir);
chdir($qdir) or die "$0: chdir: $qdir: $!\n";
printf "Incoming: %d\n", count("incoming");
printf "Active: %d\n", count("active");
printf "Deferred: %d\n", count("deferred");
printf "Bounced: %d\n", count("bounce");
printf "Hold: %d\n", count("hold");
printf "Corrupt: %d\n", count("corrupt");

编辑:修正了第26行的错字。

15
mikewaters

postqueue -p | tail -n 1

postqueue -p的最后一行显示了多少个请求和大小:

-- 317788 Kbytes in 11860 Requests.

10

[root @ server〜]#时间mailq | grep -c'^ [0-9A-Z]'

10

真正的0m1.333s

用户0m0.003s

sys 0分0.000秒

(以上结果表明有10封电子邮件正在排队)

5
Business Website Design

如果您没有qshape,则可以通过以下yum命令进行安装:

yum groupinstall Perl development
yum install postfix-Perl-scripts

qshape打印Postfix队列域和年龄分布信息。你可以在这里读更多关于它的内容:

http://www.postfix.org/QSHAPE_README.html

输出示例

% qshape -s hold | head
                         T  5 10 20 40 80 160 320 640 1280 1280+
                 TOTAL 486  0  0  1  0  0   2   4  20   40   419
             yahoo.com  14  0  0  1  0  0   0   0   1    0    12
  extremepricecuts.net  13  0  0  0  0  0   0   0   2    0    11
        ms35.hinet.net  12  0  0  0  0  0   0   0   0    1    11
      winnersdaily.net  12  0  0  0  0  0   0   0   2    0    10
           hotmail.com  11  0  0  0  0  0   0   0   0    1    10
           worldnet.fr   6  0  0  0  0  0   0   0   0    0     6
        ms41.hinet.net   6  0  0  0  0  0   0   0   0    0     6
                osn.de   5  0  0  0  0  0   1   0   0    0     4
5
Brock Hensley

这是一个例子。

#!/bin/bash

for q in active  bounce  corrupt  defer  deferred  flush  hold  incoming  maildrop  pid  private  public  saved  trace

    do
        count=$(find /var/spool/postfix/$q ! -type d -print | wc -l)
        echo $q $count
    done
2
Doug_Cowie