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 <[email protected]> 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>
------------------------------------------------------
Mailman-Users mailing list [email protected]
https://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Reply via email to