> before i hack away does anyone have a quickie for monitoring lists
> traffic? mostly i want to detect dead lists, but also to monitor
> some high-membership lists who have promised to be low-traffic.
>
> --
> -ken rich *generic_disclaimer* kenr@cc.rochester.edu
Ken:
This is not the most gorgeous code I've written, but... here it is. Hope
it's not too late.
It assumes a file, "listdata," that for me contains lists of lists "moderated,"
"unmoderated", "sensitive," "internal," (all mutually exclusive), and
"testing" (which incudes those lists that are :). It prints out to STDOUT.
Bonnie Scott
Prodigy, Inc.
------- inactive.pl ------
#!/usr/local/bin/perl
push(@INC, "/majordomo/create");
require("listdata");
$archive_dir = "/majordomo/archive";
undef @intesting;
foreach $list (@test) {
$intesting{$list} = "True";
}
opendir(DIR, $archive_dir) || die ("Unable to open archive directory");
@files = readdir(DIR);
print "\n * Moderated Lists:\n";
foreach $listname (@moderated) {
&checkitout;
}
print "\n * Unmoderated Lists:\n";
foreach $listname (@unmoderated) {
&checkitout;
}
print "\n * Sensitive Lists:\n";
foreach $listname (@sensitive) {
&checkitout;
}
print "\n * Internal Lists:\n";
foreach $listname (@internal) {
&checkitout;
}
closedir(DIR);
######## Subfunction(s) #########
sub checkitout {
print "$listname: ";
if (!$intesting{$listname}) {
@arcs = grep(/^$listname\./, @files);
if (@arcs) {
undef @months;
foreach $month (sort @arcs) {
$month =~ s/$listname\.96/96/;
$month =~ s/$listname\.97/97/;
$month =~ s/$listname\.98/98/;
$month =~ s/$listname\.99/99/;
$month =~ s/$listname\.00/00/;
# if this script is still in use in 2001, that's OK.... the output will
# just not be as compact
push (@months, $month);
}
print ("Had activity during @months.");
$l = pop(@months);
@lastmod = stat("$archive_dir/$listname.$l");
# Figure out last modified time and make it human-readable
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdat)
= localtime($lastmod[9]);
$m = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[$mon];
$lastpost = ("$mday $m, $year at $hour:$min");
print ("\n Last post: $lastpost\n");
} else {
print ("Has not had ANY recent activity.\n");
}
} else {
print ("is in testing.\n");
}
}
Follow-Ups:
|
|