@ Christopher VanOosterhout ([EMAIL PROTECTED]) :
> How do I make backups of my lists?  What files are critical?

Here's what I use as a daily cron job.

#!/bin/sh

#################### mailman_save_lists.sh #####################
# v0.13 2000-10-20 18:30
#
# this script saves a copy of mailman lists and config files
# call this script regularly from the 'mailman' user
# e.g. daily from crontab 
# 01 08 * * * /path/to/mailman_save_lists.sh
#
# we do save lists each time in compressed form: either they
# are big and we can imagine they change each time, or they
# are very small and we don't care
#
# comments to: <[EMAIL PROTECTED]>
#
# please configure below: where lists are to be found,
# and where states are to be saved (must be 'mailman'-writable)
########
lists=/var/lib/mailman/lists/
state=/var/state/mailman/
########

cd $lists || exit 1

umask 026       # make files readable to mailman group only

for i in `ls` ; do
        echo 
        echo ==================
        echo $i

        k=$state$i
        mkdir -p $k || exit 1

        j=`date +%Y-%m-%d`

        /usr/lib/mailman/bin/config_list -o $k/config-$i.new $i
        if [ -s $k/config-$i ]; then
                diff -d -I "^## captured on" \
                        $k/config-$i $k/config-$i.new > /tmp/diffconfig.$$
        else
                cp $k/config-$i.new /tmp/diffconfig.$$
        fi
        mv $k/config-$i.new $k/config-$i
        if [ -s /tmp/diffconfig.$$ ]; then
                echo "config modif ------------------------------"
                cat /tmp/diffconfig.$$
                echo "-------------------------------------------"
                cp $k/config-$i $k/config-$i-$j
                gzip -qf $k/config-$i-$j
        fi
        rm /tmp/diffconfig.$$

        /usr/lib/mailman/bin/list_members $i | sort > $k/$i-new
        printf "%10s members\n" `cat $k/$i-new | wc -l`
        if [ -s $k/$i ]; then
                diff -d $k/$i $k/$i-new > /tmp/difflist.$$
                if [ -s /tmp/difflist.$$ ]; then
                        grep "^>" /tmp/difflist.$$ > /tmp/difflistplus.$$
                        grep "^<" /tmp/difflist.$$ > /tmp/difflistminus.$$
                        if [ -s /tmp/difflistplus.$$ ]; then
                                printf " + %7s\n" `cat /tmp/difflistplus.$$ | wc -l`
                        fi
                        if [ -s /tmp/difflistminus.$$ ]; then
                                printf " - %7s\n" `cat /tmp/difflistminus.$$ | wc -l`
                        fi
                        cat /tmp/difflistplus.$$ /tmp/difflistminus.$$
                        rm /tmp/difflistplus.$$ /tmp/difflistminus.$$
                fi
                rm /tmp/difflist.$$
        else
                echo "new list !"
                cat $k/$i-new
        fi
        mv $k/$i-new $k/$i
        cp $k/$i $k/$i-$j
        gzip -qf $k/$i-$j

        # suppress last month's files
        # with two weeks security delay
        n=`date +%Y-%m --date "-1 month -2 week"`
        if [ -e $k/$i-$n-01.gz ]; then
                mv $k/$i-$n-01.gz $k/$i-$n.gz
                rm -f $k/$i-$n-??.gz
        fi
done
# END SCRIPT


-- Fil


------------------------------------------------------
Mailman-Users maillist  -  [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-users

Reply via email to