Malin hat die Gist bearbeitet . Zu Änderung gehen
1 file changed, 34 insertions
queue-size.pl(Datei erstellt)
| @@ -0,0 +1,34 @@ | |||
| 1 | + | #!/usr/bin/env perl | |
| 2 | + | ||
| 3 | + | # postfix queue/s size | |
| 4 | + | # author: | |
| 5 | + | # source: http://tech.groups.yahoo.com/group/postfix-users/message/255133 | |
| 6 | + | # from: https://serverfault.com/questions/58196/how-do-i-check-the-postfix-queue-size | |
| 7 | + | ||
| 8 | + | use strict; | |
| 9 | + | use warnings; | |
| 10 | + | use Symbol; | |
| 11 | + | sub count { | |
| 12 | + | my ($dir) = @_; | |
| 13 | + | my $dh = gensym(); | |
| 14 | + | my $c = 0; | |
| 15 | + | opendir($dh, $dir) or die "$0: opendir: $dir: $!\n"; | |
| 16 | + | while (my $f = readdir($dh)) { | |
| 17 | + | if ($f =~ m{^[A-F0-9]{5,}$}) { | |
| 18 | + | ++$c; | |
| 19 | + | } elsif ($f =~ m{^[A-F0-9]$}) { | |
| 20 | + | $c += count("$dir/$f"); | |
| 21 | + | } | |
| 22 | + | } | |
| 23 | + | closedir($dh) or die "closedir: $dir: $!\n"; | |
| 24 | + | return $c; | |
| 25 | + | } | |
| 26 | + | my $qdir = `postconf -h queue_directory`; | |
| 27 | + | chomp($qdir); | |
| 28 | + | chdir($qdir) or die "$0: chdir: $qdir: $!\n"; | |
| 29 | + | printf "Incoming: %d\n", count("incoming"); | |
| 30 | + | printf "Active: %d\n", count("active"); | |
| 31 | + | printf "Deferred: %d\n", count("deferred"); | |
| 32 | + | printf "Bounced: %d\n", count("bounce"); | |
| 33 | + | printf "Hold: %d\n", count("hold"); | |
| 34 | + | printf "Corrupt: %d\n", count("corrupt"); | |
Neuer
Älter