Re: [Exim] upgrade v3.03 to 3.16 breaks auto_thaw/retry queu…

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Corin Hartland-Swann
Data:  
Para: Michael J. Tubby B.Sc. G8TIC
CC: exim-users, Graeme Wilford
Asunto: Re: [Exim] upgrade v3.03 to 3.16 breaks auto_thaw/retry queue cleaning
Hi there,

On Mon, 9 Oct 2000, Michael J. Tubby B.Sc. G8TIC wrote:
> The following will remove the most stubborn frozen messages from your
> queue - actually it'll remove all frozen messages that it finds, even
> if they are only a few minutes old - use with care...


I noticed a minor bug with your script that will prevent it from working
where whitespace preceeds the age of the message.

> while (<QUEUE>) {
> my $in = $_;
> $in = ~s/^\s+//; # hack off leading spaces
> my ($age, $size, $id, $brackets, $from, $stuff1, $stuff2, $stuff3) = split
> /\s+/;


You are not specifying the variable to split, so it is using $_ and not
$in. IMHO, the easiest way to correct this is to omit $in completely and
to get both substitute (s///) and split to operate on $_ instead, i.e.:

> while (<QUEUE>) {
> s/^\s+//; # hack off leading spaces
> my ($age, $size, $id, $brackets, $from, $stuff1, $stuff2, $stuff3) = split
> /\s+/;


Alternatively, you could just change the script to use a match instead of
a substitute/split, which allows you to make sure that what you're getting
looks like a message ID, and gives you a warning if it fails to match what
you're expecting:

> while (<QUEUE>) {
>   if (m/^\s*(\S+)\s+\S+\s+(\w{6}-\w{6}-\w{2})/) {
>     my ($age, $id) = ($1, $2);
>     print "removing message: $id  age: $age\n";
>     system '/usr/exim/bin/exim', '-Mrm', $id;
>   } else {
>     warn "Invalid line $_";
>   }
> }


Hope this helps,

Regards,

Corin

/------------------------+-------------------------------------\
| Corin Hartland-Swann   | Direct: +44 (0) 20 7544 4676        |
| Commerce Internet Ltd  | Mobile: +44 (0) 79 5854 0027        |
| 22 Cavendish Buildings |    Tel: +44 (0) 20 7491 2000        |
| Gilbert Street         |    Fax: +44 (0) 20 7491 2010        |
| Mayfair                |    Web: http://www.commerce.uk.net/ |
| London W1K 5HJ         | E-Mail: cdhs@???        |

\------------------------+-------------------------------------/