Re: seasonal thaw?

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Piete Brooks
日付:  
To: Neal Becker
CC: exim-users
題目: Re: seasonal thaw?
> I have exim-0.42 installed on 30 unix machines.

I have 127 ...

> One problem is that I don't see messages being frozen on them unless I check.


I get cron to tell me of any old or frozen messages.

> Perhaps there should be an option to either:
> 1) periodically try to deliver frozen mail (1/week?)
> 2) send mail to an admin at some interval if there are frozen mails.


The script I use from cron could be tweaked ....

As it is, it is silent if nothing of interest.
If there are frozen messages, it prints a command which will unfreeze them.
It then lists all "old" messages.

It was written a long time ago (when I first started running exim) but still
works.

It can readily be tweaked to actually thaw the messages ...


#! /usr/bin/perl -w
$a if 0;
$b if 0;

$command = "/usr/exim/bin/exim";
$command = "/usr/lib/sendmail" unless -r $command;
$pipe    = "$command -bp|";
$older = 30;


open(STDIN, $pipe) || die("Failed to open \"$pipe\" - $!\n");

$t_pend = 0;
$t_frozen = 0;
$pend = '';
$frozen = '';
$mins = 0;
$older = 1;
&dump_data;
$entries = $[;
while (<>) {
    if (/^$/) { &dump_data; next; }


    if (/^[ \d]\d[mhd] /) {
        &dump_data;
        ($mins, $unit, $id) = m/^ *(\d+)([mhd]) *([^ ]+)/;
        $mins *= 60 if ($unit eq "h");
        $mins *= (60 *24) if ($unit eq "d");
        $frozen .= " $id" if /frozen/;
        $t_frozen++ if /frozen/;
    }
    $recip++;
    $done ++ if /^  \*/;
    $pend .= $_ unless  /^  \*/;
}


&dump_data;

exit 0 unless $entries;

$host = `uname -n 2> /dev/null || hostname 2> /dev/null`;

$host =~ s/\n$//;

printf "%-20s %3d+%-2d msg %4d recip\n", $host, $entries-$t_frozen, $t_frozen, $t_pend if $entries;

print "\n\t/usr/exim/bin/exim -Mt$frozen\n\n" if ($frozen ne '');

@ptr = sort { $age[$ptr[$b]] <=> $age[$ptr[$a]] } @ptr ;
for ($i = $[; $i < $entries; $i++) { print $data[$ptr[$i]]; }

sub dump_data {
    if ($pend && $mins >= $older) {
        $pend =~ s/\n/ ($done\/$recip)\n/;
        $data[$entries] = $pend;
        $age[$entries] = $mins;
        $ptr[$entries] = $entries;
        $entries++;
        $t_pend += $recip - $done;
    }
    $pend = '';
    $recip = -1;
    $done = 0;
}


exit $entries