October 2nd 2007

Renaming a Mailman list

This evening I renamed a number of UWCS's mailing lists for a few reasons, mostly due to the annoying ambiguity of the old names. Mailman doesn't make this particularly easy - this how you can do it under Etch;

$ OLD=old-list-name
$ NEW=new-list-name
$ set -u
$ sudo /etc/init.d/mailman stop
$ sudo test -a /var/lib/mailman/archives/private/${NEW} && echo '*** That mailing list name already exists. ***'
$ sudo mv /var/lib/mailman/lists/${OLD} /var/lib/mailman/lists/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD} /var/lib/mailman/archives/private/${NEW}
$ sudo mv /var/lib/mailman/archives/private/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox
$ sudo mv /var/lib/mailman/archives/private/${NEW}.mbox/${OLD}.mbox /var/lib/mailman/archives/private/${NEW}.mbox/${NEW}.mbox
$ sudo /var/lib/mailman/bin/arch ${NEW}
$ sudo cp /etc/aliases `mktemp aliases-backup.XXXX`
$ sudo printf "\\n# '${OLD}' -> '${NEW}' mailing list rename \\n" | sudo tee --append /etc/aliases
$ echo "${OLD}: ${NEW}" | sudo tee --append /etc/aliases
$ for SUFFIX in admin bounces confirm join leave owner request subscribe unsubscribe; do echo "${OLD}-${SUFFIX}: ${NEW}-${SUFFIX}" | sudo tee --append /etc/aliases; done
  • General / real_name: NEW
  • General / subject_prefix: "[NEW] " (or similar)
  • Privacy / Recipient filters / acceptable_aliases: Add OLD
$ sudo newaliases
$ sudo /var/lib/mailman/bin/genaliases
$ sudo /etc/init.d/mailman start

# For bonus points, generate yourself Apache redirect for the new name:

$ echo "RewriteRule ^/([^/]*)/${OLD}($|(/.*)) /\\$1/${NEW}\\$2\\$3 [R=301,L]"

Ta-da, nice new names. You will need to warn your users as their filtering will now have broken.

You can subscribe to new posts via email or RSS.