Fwd: Large Mailbox notifications

"Kirk Bauer" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
---------- Forwarded message ----------
From: Greg Parmer <[email protected]>
Date: Thu, 18 Sep 2008 13:12:10 -0500
Subject: Large Mailbox notifications
To: [email protected], [email protected]

A co-worker and I dressed up the large mailbox notification script a bit
by sorting the mailboxes and formatting the results. You're welcome to
include it in later versions if you'd like. Thanks for logwatch.

-greg




-- 

------------------------------------------------------
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration

_______________________________________________
Logwatch-Devel mailing list
[email protected]
http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
sendmail-largeboxes.diff (application/octet-stream, 1 KB)
--- sendmail-largeboxes	2008-09-18 11:29:42.000000000 -0500
+++ sendmail-largeboxes.FCS	2008-09-18 10:58:07.000000000 -0500
@@ -33,11 +33,6 @@
 	print "Can't find spool directory\n";
 }
 
-my %mailboxes;
-sub sortbyhashvalue {
-   $mailboxes{$b} <=> $mailboxes{$a};
-}
-
 if ($SPOOLDIR) {
 	opendir(DIR, "$SPOOLDIR") || die "Can not opendir $SPOOLDIR: $!\n";
 	my @files = grep {!/^\./} readdir(DIR);
@@ -46,14 +41,8 @@
 	for my $filename (@files) {
 		my $checksize = (stat("$SPOOLDIR/$filename"))[7];
                if ($checksize >= $sizebytes) {
-			$mailboxes{$filename} = $checksize;
+                       print "$title Warning: Large mailbox: $filename ($checksize)\n";
+                       $title = "";  # only print at start of report
 		}
 	}
-	
-	foreach my $key (sort sortbyhashvalue (keys(%mailboxes)) ) {	
-	 my $printkey = sprintf("%-8s", $key);	
-	 my $printsize = sprintf("  %9i", $mailboxes{$key}/1024 );	
-       	 print "$title Warning: Large mailbox: $printkey $printsize KB\n";
-         $title = "";  # only print at start of report
-	}
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.