[Mailman-Users] Mail list statistics
Alain Williams
addw at phcomp.co.uk
Fri Feb 7 18:33:36 CET 2014
On Fri, Feb 07, 2014 at 05:23:22PM +0000, Alain Williams wrote:
> I sometimes get asked how many messages are sent out to a mail list.
>
> So I wrote a script to tell me. This works under ksh or bash.
>
> 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:
# 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
# This should be run in a directory like:
# /var/spool/mailman/bray/archives/private/chat
# Note that this needs write access to the directory since it creates a temporary
# directory.
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
mkdir x || exit
ln [0-9]* x
cd x || exit
files=$( ls -f | wc -l )
(( FilesTot += files ))
(( YearTot += files ))
printf "$year $month\t$files\t$( du -h | cut -f 1 )\n"
cd .. || exit
rm -rf x
cd .. || exit
done
echo "Total for year $year: $YearTot"
done
echo "Emails total $FilesTot"
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>
More information about the Mailman-Users
mailing list