[Mailman-Users] Counting subscribers

jenni.husler at guardian.co.uk jenni.husler at guardian.co.uk
Fri Dec 8 11:29:52 CET 2000

Yeah, I did: Give this a go Sarah:

#!/usr/bin/perl -w

#email the number of members for each list to someone
#jh, 06/12/00
#note, no leading white space before format declarations allowed!!

@lists=`/bin/ls /usr/local/mailman/lists`;
$date = `/bin/date`;
open OUT, ">$outfile" or die "couldn't open logfile, $!\n";
print OUT $date, "\n\n";

for $list (@lists)
     $members = get_members($list);
     write_file($list, $members);

sub get_members($list)
     my $list = shift;
     chomp $list;
     if (($list eq "anatomy_&_physiology") or ($list eq "art_&_design") or
($list eq 'theupdate')) {next;}
     @members=`/usr/local/mailman/bin/list_members $list`;
     chomp @members;
     $num_members=$#members + 1;
     return $num_members;

sub write_file($list, $members)}
     my $list =shift;
     my $members =shift;
format OUT_TOP =
Number of members per list

format OUT =
@<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>
$list,                    $members
     write OUT;

close OUT;
`cat $outfile | /bin/mail -s "this week's list sizes" <your email
address here>`;

"Sarah K. Miller" wrote:
> I want to be able to run a script similar to list_lists and have it return
> the name of the list *and* the number of members on that list. Has anybody
> done this and, if so, would you be willing to share??
>  -- Sarah
> ------------------------------------------------------
> Mailman-Users maillist  -  Mailman-Users at python.org
> http://www.python.org/mailman/listinfo/mailman-users

More information about the Mailman-Users mailing list