[Mailman-Users] Re: Rotating mailman mbox archives

Paul Williams paul.williams at uwex.edu
Wed Nov 3 16:34:53 CET 2004

I couple of weeks ago I asked how people were
dealing with disk storage with mailman archives.

I didn't receive an email that I could use.  In the end
we used a similar method that we were using with listproc.

If anyone is interested, I have indicated the method
in the following description.  Someone may find it useful.

We elected to rotate the mbox archives monthly and keep
6 versions and also save them in gzip format to conserve space.
We do this via a crontab entry as follows

0 0 1 * *  /bin/su - mailman -c '/usr/local/etc/mailman/cycle-mbox-gz | \
           mail -s "mailman mboxes cycled `date`" mailman' \
                1>/dev/null 2>/dev/null

The cycle-mbox-gz file is as follows (I don't know who
wrote the rotate() script)

# Shell script which cycles your 
~mailman/archives/private/LIST-NAME.mbox/LIST-NAME.mbox.x.gz files
# then copies the latest mbox to mbox.o and gzips it.
# It retains 6 units (a unit can be a day, week, month ...)
# It should be run out of the mailman's account (server) cron entry.
# as in /bin/su - mailman -c '/usr/local/etc/mailman/cycle-mbox-gz'

# Change log
# paulw  10-25-04       Changed so it rotates mailman mailboxes


rotate() {
         file="$1"; shift
         rm -f "$file.$1.gz"
         for i in "$@"; do
                 [ "$i" = "0" ] && j="" || j=".`expr $i - 1`"
                 [ -f "$file$j.gz" ] && mv -f "$file$j.gz" "$file.$i.gz"
         if [[ -s $file ]]; then
           cp $file $file.0 ; chmod 664 $file.0
           gzip $file.0
           cp /dev/null "$file"

# Find and cycle the mboxes ...
#for FILE in "test2"
for FILE in `$MAILMAN/bin/list_lists -b`
         rotate $MM_ARCHIVE_DIR/$FILE.mbox/$FILE.mbox 5 4 3 2 1 0
         #echo $MM_ARCHIVE_DIR/$FILE.mbox/$FILE.mbox

It seems to work as long as you don't need to run the
~mailman/bin/arch command and regenerate the indexes.


More information about the Mailman-Users mailing list