Virus epidemic, 11,000 messages waiting! (Script)

Denis Beauchemin Denis.Beauchemin at USHERBROOKE.CA
Wed Jun 16 14:49:41 IST 2004


Max,

Just some small improvements (see inline):

Max Kipness wrote:

>#!/usr/bin/perl
>
># Mail addressed to this recipient will be deleted from inbound queue
>$recipient = 'user at domain.com';
>
>opendir(DIR, "/var/spool/mqueue.in/")
>        or die ("Cannot read dir: $!\n");
>
>while ($message = readdir(DIR)) {
>
>        if ($message =~ /qf/) {
>  
>
          if ($message =~ /^qf/) {

>                $id = (split /qf/, $message)[1];
>                $qf_file = $message;
>                $df_file = "df$id";
>
>                open (MSG, "/var/spool/mqueue.in/$message")
>                                or die ("Cannot open message: $!");
>
>                while (<MSG>) {
>
>                        if (/RPFD\:\<$recipient\>/){
>
>                                unlink
>("/var/spool/mqueue.in/$qf_file");
>                                unlink
>("/var/spool/mqueue.in/$df_file");
>  
>
                                  $cnt += unlink("/var/spool/mqueue.in/$qf_file", "/var/spool/mqueue.in/$df_file");

>                                $cnt++
>          
>                        }  
>                }
>        }
>}            
>
>print "Deleted Total: $cnt\n";
>
>  
>
Denis

-- 
   _
  °v°   Denis Beauchemin, analyste
 /(_)\  Université de Sherbrooke, S.T.I.
  ^ ^   T: 819.821.8000x2252 F: 819.821.8045

-------------------------- MailScanner list ----------------------
To leave, send    leave mailscanner    to jiscmail at jiscmail.ac.uk
Before posting, please see the Most Asked Questions at
http://www.mailscanner.biz/maq/     and the archives at
http://www.jiscmail.ac.uk/lists/mailscanner.html




More information about the MailScanner mailing list