![](https://secure.gravatar.com/avatar/d4258e6caa5b231603e992b430199997.jpg?s=120&d=mm&r=g)
I just double checked and it works fine on all my sites... Do you have any lists with "=" in the name?
If that is the case, then you would need to modify the first line and add in an additional cut:
SIZ=grep -i "post to $i" $POST |grep success |cut -f2- -d, | \ cut -f2 -d= |cut -f1 -d,
k=0; for j in $SIZ; do k=$(( j + k )); done
echo " Total bytes" = $k >> $TMPFILE
This additional cut will remove the listname from the line before using the "=" to isolate the size of the message
If that doesn't do it for you, then drop a copy of your post log and the name of the list with the problems and I'll see what needs to be modified.
Hope this is helpful - Jon Carnes
On Fri, 2004-02-27 at 10:24, Al Black wrote:
Hi Jon,
I trying out the mm_stats script you wrote (see http://www.mail-archive.com/mailman-users@python.org/msg15378.html) and have a couple of little bugs you might be able to help me with. I'm using version 2.1.4 of mailman.
I get two errors running the script from command line.
The first is:
===: not found
I'm pretty sure this happens when the script hits a list we have that has no traffic.
The second one is the one I'm more concerned with:
/usr/home/lamps/test/mm_stats: arith: syntax error: " j + k "
What seems to be happening is that the lines: # SIZ=
grep -i "post to $i" $POST |grep success |cut -f2 -d= |cut -f1 -d,
# k=0; for j in $SIZ; do k=$(( j + k )); doneisn't cutting the size=field properly.
Any suggestions for a fix? Otherwise the script is running great, and it will make my list members happy. (In fact maybe it, or a bunch of variations on it, could be included in the mailman 3 suite.)
Thanks in advance, al
# Mailman's log file to be examined for stats POST=/usr/home/lamps/usr/local/mailman/logs/post
# create temp file to collect stats TMPFILE=
mktemp /tmp/mm_stats.XXXXXX
|| exit 1LIST="
/usr/home/lamps/usr/local/mailman/bin/list_lists |awk '{print $1}' |sed -n '2,$p'
" for i in $LIST do echo "Stats from local Mailman list: $i" > $TMPFILE echo " " >> $TMPFILE echo -n " Starting: " >> $TMPFILE head -1 $POST |cut -f1-3 "-d " >> $TMPFILE echo -n " Ending: " >> $TMPFILE tail -1 $POST |cut -f1-3 "-d " >> $TMPFILE echo " ======================================= " >> $TMPFILE echo -n "Total posts to the list: " >> $TMPFILE grep -i "post to $i " $POST |wc -l >> $TMPFILE echo -n "Total SUCCESSFUL posts to the list: " >> $TMPFILE grep -i "post to $i " $POST |grep success |wc -l >> $TMPFILE # SIZ=grep -i "post to $i" $POST |grep success |cut -f2 -d= |cut -f1 -d,
# k=0; for j in $SIZ; do k=$(( j + k )); done echo " Total bytes" = $k >> $TMPFILE echo " " >> $TMPFILE echo "Top 10 posters to the list:" >> $TMPFILE grep -i "post to $i " $POST |cut -f 10 "-d " |sort |uniq -c
|sort -bgr |head -10 >> $TMPFILE echo " " >> $TMPFILE # Mail the collected stats off to the list admin and cc the mailman user # mail -s "Mailman Stats for List: $i" -c mailman $i-admin <$TMPFILE # mail the collected Stats for lists to the server admin mail -s "Mailman Stats for List: $i" server-admin <$TMPFILE done
![](https://secure.gravatar.com/avatar/a55158eb69defddceedceea56b9d9ec5.jpg?s=120&d=mm&r=g)
Hey John,
At 01:08 PM 2/27/2004 -0500, Jon Carnes wrote:
I just double checked and it works fine on all my sites... Do you have any lists with "=" in the name?
If that doesn't do it for you, then drop a copy of your post log and the name of the list with the problems and I'll see what needs to be modified.
Nope didn't do the trick. None of the lists have an "=" in them but all but two have "-"
lls test lls-business lls-ts lls-12step-men lls-12step-women
I've attached the post logs, although there's not much in it because I rotated them a while ago. If its better I can un pack one, and send it along. The bug still happens though, even with the limited set.
Thanks.
al
Feb 27 10:52:19 2004 (42920) post to test from test-bounces@aa-lamplighters.org, size=950, message-id=<mailman.0.1077904336.42918.test@aa-lamplighters.org>, 1 failures Feb 27 10:54:51 2004 (42920) post to test from test-bounces@aa-lamplighters.org, size=950, message-id=<mailman.2.1077904490.42918.test@aa-lamplighters.org>, 1 failures Feb 27 10:55:32 2004 (42920) post to lls from alblack@achilles.net, size=1549, message-id=<5.2.0.9.0.20040227125529.02d28958@pop.achilles.net>, success Feb 27 11:11:16 2004 (42920) post to lls from chicaricax@aol.com, size=1388, message-id=<80.64d9a2f.2d70e22c@aol.com>, success Feb 27 11:25:29 2004 (42920) post to lls from clb14@humboldt.edu, size=2461, message-id=<1154.137.150.29.92.1077906378.squirrel@webmail.humboldt.edu>, success Feb 27 11:43:31 2004 (42920) post to lls from tye@adnc.com, size=3733, message-id=<001c01c3fd61$90b7b740$bbddd8d1@D2407T31>, success Feb 27 11:45:54 2004 (42920) post to 12-step-women from jenifer_mule@yahoo.com, size=1495, message-id=<20040227184544.71558.qmail@web41713.mail.yahoo.com>, success Feb 27 11:51:38 2004 (42920) post to 12-step-women from lillamb1997@yahoo.co.uk, size=1234, message-id=<000301c3fd62$c2086be0$9800a8c0@obione>, success Feb 27 12:01:55 2004 (42920) post to lls from lyndi@insightbb.com, size=1949, message-id=<403F9403.CFF8EEC4@insightbb.com>, success Feb 27 12:02:45 2004 (42920) post to lls from arkie@hawaii.rr.com, size=2310, message-id=<BC64B810.F7DB%arkie@hawaii.rr.com>, success Feb 27 12:27:07 2004 (42920) post to lls from jenifer_mule@yahoo.com, size=3337, message-id=<20040227192652.61900.qmail@web41710.mail.yahoo.com>, success Feb 27 12:35:53 2004 (42920) post to lls from bwtyler@email.com, size=1622, message-id=<!~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAA2BrmIb0c1EOFE7B/Cg9dzcKAAAAQAAAA6lJ+pmhxW0aVnoAL++d4VgEAAAAA@email.com>, success Feb 27 12:45:14 2004 (42920) post to lls from gomez423@adelphia.net, size=1370, message-id=<ECEPLGNNJMINLGDFLBLCOEDACCAA.gomez423@adelphia.net>, success
![](https://secure.gravatar.com/avatar/d4258e6caa5b231603e992b430199997.jpg?s=120&d=mm&r=g)
On Fri, 2004-02-27 at 15:25, Al Black wrote:
Hey John,
At 01:08 PM 2/27/2004 -0500, Jon Carnes wrote:
I just double checked and it works fine on all my sites... Do you have any lists with "=" in the name?
If that doesn't do it for you, then drop a copy of your post log and the name of the list with the problems and I'll see what needs to be modified.
Nope didn't do the trick. None of the lists have an "=" in them but all but two have "-"
lls test lls-business lls-ts lls-12step-men lls-12step-women
I've attached the post logs, although there's not much in it because I rotated them a while ago. If its better I can un pack one, and send it along. The bug still happens though, even with the limited set.
Thanks.
al
Sorry, Al
Your sample worked just fine - no errors. I checked it against all your list names. Check your script for typos.
You can also run each part of the script and see what results you get:
grep -i "post to lls" post # this will show you all the attempted posts to list lls
grep -i "post to lls" post |grep success # this will show you all successful posts to the list lls
grep -i "post to lls" post |grep success |cut -f2 -d= # this will remove all info on the left side of the message size # the output will like like this: 1549, message-id 1388, message-id 2461, message-id 3733, message-id 1949, message-id 2310, message-id 3337, message-id 1622, message-id 1370, message-id
grep -i "post to lls" post |grep success |cut -f2 -d= |cut -f1 -d, # this drops the info to the right of the message size # the message size is now isolated on each line: 1549 1388 2461 3733 1949 2310 3337 1622 1370
It worked just fine here. Good luck again
Jon Carnes
![](https://secure.gravatar.com/avatar/bbea79e5daec0b48110dc581d4b60058.jpg?s=120&d=mm&r=g)
When I send the Who command to the list and get the response from the server, each email address has 8 spaces in front of it. I would like to express at least one request to remove those spaces in the code that generates the list as I have to manually do so when I am moving addresses between lists. It's not a big deal, obviously, but it would be helpful.
participants (3)
-
Al Black
-
Jon Carnes
-
Mike Phillips