On Fri, Feb 29, 2008 at 10:09 PM, Mark Sapiro <[EMAIL PROTECTED]> wrote:
> Matt Morgan wrote:
> >
> >The only problem is that a lot of their addresses are collected
> >manually, so there can be a lot of failures. Mailman sends these one
> >at a time, i.e. one unsubscribed address per notification message, and
> >not really all at once (although I'm sure that depends on how quickly
> >the bounce message comes back, too). Is it possible to get mailman to
> >batch the unsubscribed addresses once per day, and send them all out
> >in a single daily report? Or is there some other way to do this that
> >would work better than what I've come up with?
>
>
> You could turn the notices to the admin off and run a daily cron to
> generate a summary from Mailman's subscribe log. All the bounce
> deletes should have entries similar to
>
> Feb 20 10:00:24 2008 (10510) listname: deleted [EMAIL PROTECTED];
> disabled address
>
> You can also work off the bounce log which will have entries like
>
> Feb 20 10:00:24 2008 (10510) listname: [EMAIL PROTECTED] disabling due
> to bounce score 1.0 >= 1.0
> Feb 20 10:00:24 2008 (10510) listname: [EMAIL PROTECTED] deleted after
> exhausting notices
Thanks, Mark! Great tip. Here's what I came up with. I'm sure this can
be improved upon, but maybe it'll help someone else.
----------
bademails script
----------
#!/bin/sh
#
# This is a crummy little script to be run by cron that will collect
# deleted emails from any number of days before and send them to
# some address.
usageQuit()
{
cat << "EOF" >&2
bademails processes mailman's subscribe logs for recently deleted members
Usage: bademails recipient [-d days]
recipient is the email address to send the report to
days is an integer value for the number of days of messages to parse
(default is 1, i.e., yesterday)
EOF
exit 1
}
days=1
file=/tmp/badaddresses
case $# in
0 ) usageQuit ;;
1 ) usageQuit ;;
2 ) email=$1; days=$2; ;;
? ) usageQuit ;;
esac
daysleft=$days
while [ $daysleft -gt 0 ] ; do
logfile="/var/log/mailman/subscribe.$daysleft.gz"
if [ -f $logfile ] ; then
zcat $logfile|grep deleted|cut -d' ' -f8|sed -e 's/;//' >> $file
fi
daysleft=$(( $daysleft -1 ))
done
if [ -f $file ] ; then
sort -f -u $file | mail -s"$days days of bad addresses" $email
rm $file
fi
exit 0
---------
Thanks,
Matt
------------------------------------------------------
Mailman-Users mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe:
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org
Security Policy:
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq01.027.htp