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;

  • First, define variables to avoid stupid mistakes:
$ OLD=old-list-name
$ NEW=new-list-name
$ set -u
  • Next, take down Mailman and do a quick sanity check. The MTA should queue any incoming mails when qrunner stops responding:
$ sudo /etc/init.d/mailman stop
$ sudo test -a /var/lib/mailman/archives/private/${NEW} && echo '*** That mailing list name already exists. ***'
  • Now move the list data and regenerate the archives for that list:
$ 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}
  • You should probably provide legacy aliases:
$ 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
  • Now go to the administrator interface and change:
  • General / real_name: NEW
  • General / subject_prefix: "[NEW] " (or similar)
  • Privacy / Recipient filters / acceptable_aliases: Add OLD
  • Now, bring everything back online with:
$ 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.