4.6. How can I backup my Mailman lists/membership/etc on a regular basis?
You should of course have regular, reliable, and tested site backup procedures for all your data, not just your Mailman lists. However, there are advantages to making and/or distributing backups of your list configurations in other and possibly more flexible and frequent manners than your site backup procedures.
See also FAQ 4.18 at 4.18 How do I backup my lists and their configurations-membership rosters?
J C Lawrence <claw@kanga.nu> uses the following approach:
Note: You'll need to have a reasonably recent version of nmh installed as the scripts rely on the MH tools to build a MIME message:
http://www.nongnu.org/nmh/
The scripts:
#set -x subject=$1 file=$2 addr=$3 echo "To: ${addr} From: nobody Subject: ${subject} #application/octet-stream [${subject}] ${file} " | /usr/bin/mh/mhbuild - > /tmp/mimemail.tmp.${$} /usr/lib/mh/post -verbose -watch /tmp/mimemail.tmp.${$} rm /tmp/mimemail.tmp.${$}
#set -x datestr=`date +%Y%m%d` host=`hostname -f` file=mailman.lists.${datestr}.tar.gz filepath=~/backups/${file} sendto="root" cd /var/lib/mailman tar zcf ${filepath} lists cd ~/backups mimemail ${file} ${filepath} ${sendto} #rm ${file}
Yeah, there are some hard coded paths in there. Sue me. I never said they were pretty, merely that they worked. Brief explanation:
mimemail takes three arguments: the Subject: of the message its going to send, the file it is going to send, and the address it is going to send it to. mimemail depends on the nmh tools to build the MIME message.
mailman.backup takes no arguments. It creates a compressed tarball of ~mailman/lists in the file ~/backups/mailman.lists.YYMMDD.tar.gz eg: mailman.lists.20011128.tar.gz And then uses mimemail to send that file to root@localhost (edit/change if you want) before deleting it.
To use drop them in a cronjob something like:
0 6 * * 0 /home/archiver/bin/mailman.backup
A sample execution should look something like:
$ ./mailman.backup -- Posting for All Recipients -- -- Local Recipients -- root: address ok -- Recipient Copies Posted -- Message Processed
The result will be that every time the cronjob runs it will send you (in this case root@host.dom) a message looking something like:
Subject: mailman.lists.20011128.tar.gz From: nobody@kanga.nu Date: Wed, 28 Nov 2001 21:12:55 -0800 To: root@kanga.nu <MIME attachment application/octet-stream>
Where the MIME attachment is the tarball constructed by ~/bin/mailman.backup. Edit the value of sendto in mailman.backup if you want them going somewhere else.
Converted from the Mailman FAQ Wizard
This is one of many Frequently Asked Questions.