[Mailman-Users] Extract list of lists with population?

Charles Sprickman spork at bway.net
Thu Jul 1 21:26:06 CEST 2004


Here's some really ugly perl that I slapped together last night.  I think
it does what the OP wanted.  It sends mail and writes a log.

Thanks,

Charles
___
Charles Sprickman
NetEng/SysAdmin
Bway.net - New York's Best Internet - www.bway.net
spork at bway.net - 212.655.9344


On Thu, 1 Jul 2004, Mark J. Bradakis wrote:

> Depending on your shell, something like
>
> foreach l ( `/your/path/to/mailman/bin/list_lists -b `)
>  echo -n $l
>  /your/path/to/mailman/bin/list_members | wc -l
>  end
>
> might do the trick.
>
>
> mjb.
> ----
>
> Unthinking respect for authority is the greatest enemy of truth.
>  -Albert Einstein.
>
>
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
>
-------------- next part --------------
#!/usr/bin/perl

# $Id: list-lists.pl,v 1.4 2004/07/01 19:12:55 spork Exp $

#  quick script to list all mailman lists and give a
#  subscriber count for each

$mailman_bin = "/usr/local/mailman/bin";
$lists_prog = "$mailman_bin/list_lists";
$members_prog = "$mailman_bin/list_members";
$owners_prog = "$mailman_bin/list_owners";
$mail_recip = "someone\@somewhere.net";
$mail_from = "someone\@somewhere.net";
$logfile = "/usr/local/adm/data/mailman-report.log";
$now = localtime;

open(LISTS, "$lists_prog -b |");

while (<LISTS>) {
	chomp;
	push(@lists,$_);
}

close LISTS;

format MAIL_TOP =

This monthly report shows how many subscribers each hosted list
is using, who owns the list, and the list name.

Subscribers   List Owner	           List Name
-----------   ----------	           ---------
.
format LOG_TOP =

Subscribers   List Owner	           List Name
-----------   ----------	           ---------
.
format MAIL =
@<<<<<<<<<<   @<<<<<<<<<<<<<<<<<<<<<<<<<<  @<<<<<<<<<<<<<<<<<<<<<<<<
$member_count, $owner, $list
.
format LOG =
@<<<<<<<<<<   @<<<<<<<<<<<<<<<<<<<<<<<<<<  @<<<<<<<<<<<<<<<<<<<<<<<<
$member_count, $owner, $list
.


open(LOG, ">> $logfile") || die "Can't open log for writing\n";
print LOG "report for $now\n\n"; 
open(MAIL, "| /usr/sbin/sendmail -f $mail_from $mail_recip");
print MAIL "To: $mail_recip\nSubject: Monthly Mailing List Report\n";

while (<@lists>) {
	$list = $_;
	$member_count = 0;

	open(OWNERS, "$owners_prog $list |");
	$owner = <OWNERS>;
	chomp($owner);
	close OWNERS;

	open(MEMBERS, "$members_prog $list |");
	while (<MEMBERS>) {
		$member_count++;
	}
	close MEMBERS;

	write MAIL;
	write LOG;
	#print "$member_count\t\t$owner\t\t$list\n";
}

print LOG "\nEND\n\n";
close MAIL;
close LOG;


More information about the Mailman-Users mailing list