Virus epidemic, 11,000 messages waiting! (Script)
Max Kipness
mkipness at GENIANT.COM
Wed Jun 16 00:26:28 IST 2004
Thanks to everybody for the suggestions. Will the pointers I read from
everyone, I ended up writing this script. It seemed to work, so if
anybody ever has the issue, here it is:
#!/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/) {
$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++
}
}
}
}
print "Deleted Total: $cnt\n";
-------------------------- 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