Postfix sendmail -bp
İle eşdeğerdir?
Veya daha az yazarak:
mailq
qshape etkin
size her bir alana gönderilen e-postaların sayısını ve etkin sırada ne kadar süredir bulunduğunu gösterir
qshape ertelendi
aynısını gösterecek ama ertelenmiş kuyruk için
postqueue -p
Postfix posta listesinden alındığımı kullanıyorum. Burada istemediği takdirde yazarın adını kaldırdım (kaynağında görebilirsiniz). Yalnızca toplamları görüntüler.
#!/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");
EDIT: 26 satırındaki bir yazım hatası düzeltildi.
postqueue -p | tail -n 1
postqueue -p
kaç istek ve boyut gösterir:
-- 317788 Kbytes in 11860 Requests.
[root @ sunucu ~] # zaman mailq | grep -c '^ [0-9A-Z]'
10
gerçek 0m1.333s
kullanıcı 0m0.003s
sys 0m0.003s
(10 e-postanın sıra olduğunu gösteren sonucun üstünde)
qshape
dosyanız yoksa, aşağıdaki yum komutlarını kullanarak yükleyebilirsiniz:
yum groupinstall Perl development
yum install postfix-Perl-scripts
qshape Postfix sıra etki alanını ve yaş dağılımı bilgilerini yazdırır. Bununla ilgili daha fazla bilgiyi burada bulabilirsiniz:
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
İşte bir örnek.
#!/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