[Mailman-Users] Mail list statistics
Mark Sapiro
mark at msapiro.net
Fri Feb 7 20:33:05 CET 2014
On 02/07/2014 09:33 AM, Alain Williams wrote:
>>
>> The script is attached and I am happy for this to become part of mailman or put
>> into an associated library.
>>
>> You need to run it in the list's archive directory.
>
> Drat, this list does not allow attachments, so here it is in line:
Actually, it does but only of MIME type text/plain or text/x-diff.
I have attached a revision. Changes include:
- It only needs read access to Mailman's archives.
- It can run from anywhere.
Granted the total-message-size is a bit off because it includes the
various index files, but it's close in most cases, and since it includes
all the html boiler plate, it isn't that accurate to begin with.
I can add this to the contrib directory in the distribution.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
-------------- next part --------------
# Show how much email sent through a mailman mail list
# Copyright (c) Alain Williams <addw at phcomp.co.uk> January 2009
# This program is free software and is licenced under the GPL: http://www.gnu.org/copyleft/gpl.html
# Usage: /path/to/script LISTNAME
# Note: this only works if the list's archive_volume_frequency is monthly.
# Also, the total message size for the month includes the index files.
# Set the path to Mailman's private archives directory.
# Adjust for your installation.
ARCHIVES="/usr/local/mailman/archives/private"
# cd to the list
cd $ARCHIVES/$1 || exit
echo "Columns: month number-of-messages total-message-size"
Months="January February March April May June July August September October November December"
FilesTot=0
# Work out starting year, look for something like: 2004-December
startYear=$( ls | perl -wlne '$year = $1 if(/^(\d\d\d\d)-/ and ( !defined($year) or $1 < $year)); END {print $year }' )
endYear=$( date '+%Y' )
for year in $( seq $startYear $endYear )
do echo "Year $year"
YearTot=0
for month in $Months
do
[[ ! -d $year-$month ]] && printf "$year $month\tnone\n" && continue
cd $year-$month || exit
files=$( ls -f [0-9]* | wc -l )
(( FilesTot += files ))
(( YearTot += files ))
printf "$year $month\t$files\t$( du -h | cut -f 1 )\n"
cd .. || exit
done
echo "Total for year $year: $YearTot"
done
echo "Emails total $FilesTot"
More information about the Mailman-Users
mailing list