Mailman List Membership Changes
In this example, we report changes in GNU Mailman list memberships, both by count, also by doing a diff against the previous list membership.
The MailmanListMembershipChanges script might send an alert message like the following:
PIKT ALERT
Thu Sep 15 14:52:47 2005
moscow
INFO:
MailmanListMembershipChanges
Report changes in Mailman list memberships.
for emf-announce, current membership is now 1777, was 1775
< john_doe001@juno.com
---
> john.doe001@gmail.com
118a119
> enriquebz06@earthlink.net
434d434
< petra0090@aol.com
748d747
> missdaisy023@yahoo.com
1053d1051
> annp020@closedborder.net
for emr-comm, current membership is now 347, was 346
> gustaf080@xyz.org
The script follows.
MailmanListMembershipChanges
init
status =piktstatus
level =piktlevel
task "Report changes in Mailman list memberships."
input proc "=mailmanbindir/list_lists | =egrep -iv matching"
dat $list 1
keys $list
rule // initialize for current list
set #changed = #false()
rule // determine current list membership
set #mbrs = #val($command("=mailmanbindir/list_members $list | =wc -l"))
rule // determine if membership changed
if #mbrs != %mbrs
output mail "for $list, current membership is now $text(#mbrs),
was $text(%mbrs)"
set #changed = #true()
fi
rule // if changed and have list history, mv to backup
if #changed
if -e "=hstdir/mailman/$list"
=execwait "=mv =hstdir/mailman/$list
=hstdir/mailman/$list\.piktbak"
fi
fi
rule // save current membership in the histories/mailman directory
if ! -d "=hstdir/mailman"
=execwait "=mkdir =hstdir/mailman; =chmod 750 =hstdir/mailman"
fi
=execwait "=mailmanbindir/list_members $list > =hstdir/mailman/$list"
rule // if changed, and we have a backup of the previous
// list, diff the current against the previous,
// else dump the current list
if #changed
if -e "=hstdir/mailman/$list\.piktbak"
=outputproc(mail, "=diff =hstdir/mailman/$list\.piktbak
=hstdir/mailman/$list | =tail +2")
output mail =newline
else
=outputfile(mail, "=hstdir/mailman/$list")
output mail =newline
fi
fi
This is just one program example. You could write new scripts, for example to: monitor and report problems with Mailman list configurations, report failures to archive list messages, etc.
For more examples, see Samples.