[Mailman-Users] Re: Creating reports
David Gibbs
david at midrange.com
Sun Jul 14 15:13:50 CEST 2002
"Heather J. Lubinsky" <heather at pcgal.com> wrote in message
news:0b8a01c22b14$27267fd0$84d667d8 at lubinsky.com...
> We have about 60 lists and 10,000 people -- Every month I need to report
how
> many on each list.
I've got a couple of scripts I hacked together to do just that... it isn't
the most elegent solution, but it works.
It requires a modification to the list_lists script and a new list-summary
shell script...
Here's a patch for the list_lists script...
------------------->>>>>>>---------------------------
--- list_lists_old Wed Aug 29 22:29:11 2001
+++ list_lists Fri Jul 12 06:11:35 2002
@@ -26,6 +26,10 @@
-a
List only those mailing lists that are publically advertised
+ --bare
+ -b
+ Displays only the list name, no description
+
--virtual-host-overview=domain
-V domain
List only those mailing lists that are homed to the given virtual
@@ -60,13 +64,14 @@
def main():
try:
- opts, args = getopt.getopt(sys.argv[1:], 'aV:h',
+ opts, args = getopt.getopt(sys.argv[1:], 'abV:h',
['advertised', 'virtual-host-overview=',
- 'help'])
+ 'bare', 'help'])
except getopt.error, msg:
usage(1, msg)
advertised = 0
+ bare = 0
vhost = None
for opt, arg in opts:
@@ -74,6 +79,8 @@
usage(0)
elif opt in ('-a', '--advertised'):
advertised = 1
+ elif opt in ('-b', '--bare'):
+ bare = 1
elif opt in ('-V', '--virtual-host-overview'):
vhost = arg
@@ -93,15 +100,21 @@
mlists.append(mlist)
longest = max(len(mlist.real_name), longest)
- if not mlists:
+ if not mlists and not bare:
print 'No matching mailing lists found'
return
- print len(mlists), 'matching mailing lists found:'
+ if not bare:
+ print len(mlists), 'matching mailing lists found:'
+
format = '%%%ds - %%.%ds' % (longest, 77 - longest)
+
for mlist in mlists:
description = mlist.description or '[no description available]'
- print ' ', format % (mlist.real_name, description)
+ if bare:
+ print mlist.real_name
+ else:
+ print ' ', format % (mlist.real_name, description)
if __name__ == '__main__':
------------------->>>>>>>---------------------------
And here's the main script to build a summary html page ...
------------------->>>>>>>---------------------------
#! /bin/sh
MAILMAN="/usr/local/home/mailman/bin"
BASEURL="http://lists.midrange.com/cgi-bin"
TITLE="MIDRANGE dot COM Public Mailing List Statistics"
TMPNAME=`basename $0`
TMPFILE=`mktemp /tmp/$TMPNAME.XXXXXX` || exit 1
for LIST in `$MAILMAN/list_lists --advertised --bare`
do
$MAILMAN/list_members $LIST >> $TMPFILE
done
COUNT=`sort --ignore-case $TMPFILE|uniq --ignore-case|wc --lines`
cat <<EOF1
<html>
<head>
<title>$TITLE</title>
<meta name="robots" content="noindex,follow,noarchive">
</head>
<body>
<p><center><big><big>$TITLE</big></big></center></p>
<div align="center"><center>
<table border="1">
<tr>
<th></th>
<th colspan="3">Membership</th>
</tr>
<tr>
<th>List Name</th>
<th align="center">Total</th>
<th align="center">Regular</th>
<th align="center">Digest</th>
</tr>
EOF1
TOTAL_BOTH=0
TOTAL_REGULAR=0
TOTAL_DIGEST=0
for LIST in `$MAILMAN/list_lists --advertised --bare`
do
BOTH=`$MAILMAN/list_members $LIST|wc -l`
REGULAR=`$MAILMAN/list_members --regular $LIST|wc -l`
DIGEST=`$MAILMAN/list_members --digest $LIST|wc -l`
let TOTAL_BOTH=$(($TOTAL_BOTH+$BOTH))
let TOTAL_REGULAR=$(($TOTAL_REGULAR+$REGULAR))
let TOTAL_DIGEST=$(($TOTAL_DIGEST+$DIGEST))
cat <<EOF2
<tr>
<td><a href="$BASEURL/listinfo/$LIST">$LIST</a></td>
<td align="center">$BOTH</td>
<td align="center">$REGULAR</td>
<td align="center">$DIGEST</td>
</tr>
EOF2
done
cat <<EOF3
<tr bgcolor="#C0C0C0">
<td><b>Grand Total</b></td>
<td align="center">$TOTAL_BOTH</td>
<td align="center">$TOTAL_REGULAR</td>
<td align="center">$TOTAL_DIGEST</td>
</tr>
</table>
<p>
<hr>
Total unique mailing list subscribers (all lists): $COUNT
<hr>
EOF3
TODAY=`date`
cat <<EOF4
<p align="center"><small><em>Last updated $TODAY</em></small></p>
</center></div>
</body>
</html>
EOF4
------------------->>>>>>>---------------------------
More information about the Mailman-Users
mailing list