Thanks for all your help thus far. If I wanted to view the numbers to
the right of the pound sign(#) also, how would I go about doing that?
Is creating another value to the key the right idea?
+++++++++++ Beginning of data +++++++++++++++++++++++++++++++++++++++++
28 Aug 2007 17:00:47 GMT #8807850 41428 <[EMAIL PROTECTED]>
done remote [EMAIL PROTECTED]
done remote [EMAIL PROTECTED]
done remote [EMAIL PROTECTED]
done remote [EMAIL PROTECTED]
+++++++++++ End of Data ++++++++++++++++++++++++++++++++++++++++++++++++
I want to be able to add the '#8807850' as part of the data. This is
what I have so far:
+++++++++++ SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl
$MAILTO='[EMAIL PROTECTED]';
$output = `/var/qmail/bin/qmail-qstat`;
($a, $b, $c, $num) = split(" ", $output);
if ($num > 600) {
open (CMD, "/var/qmail/bin/qmail-qread|") or die "Unable to
execute qmail-qread!\n";
my ( $key, %data );
while ( <CMD> ) {
#if ( /#.*\s(\S+)/ ) {
# Below takes the sender email address in the instance of the
word "bouncing" in qmail-qread output
if ( /#.*\d+\s+\d+\s+(\S*)/ ) {
$key = $1;
}
elsif ( /\sremote\s/ ) {
$data{ $key }++;
}
}
open(MAIL,"|mail -s 'QMAIL Queue Overload on Server' $MAILTO");
print MAIL "$num emails stuck in queue! \n";
print MAIL "\n";\
foreach $key (sort {$data{$b} <=> $data{$a} } keys %data){
if ($data{$key} > 20){
print MAIL "$key sent $data{$key} emails.\n";
}
}
close MAIL;
}
+++++++++++ /SCRIPT ++++++++++++++++++++++++++++++++++++++++++++++++++
In the End, I want to be able to see:
"<[EMAIL PROTECTED]> sent 4 emails with Message ID #8807850".
Thanks....
-Chris
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/