Skip to content

Instantly share code, notes, and snippets.

@adamamyl
Created October 9, 2013 22:44
Show Gist options
  • Save adamamyl/6909815 to your computer and use it in GitHub Desktop.
Save adamamyl/6909815 to your computer and use it in GitHub Desktop.
Script to rename a Mailman list
#!/bin/sh
#
# rename-list:
# rename lists
#
# Copyright (c) 2010 Adam McGreggor. All rights reserved.
# Email: adam@amyl.org.uk; WWW: http://blog.amyl.org.uk
#
# $Id: rename-list 260 2010-10-18 11:57:34Z adam $
#
MMHOME=/var/lib/mailman
if [ -z "$1" ] && [ -z "$2" ]; then
echo "specify old name (ARG1) and new name (ARG2)"
exit 0
else
if [ ! -d ${MMHOME}/lists/${1}/ ]; then
echo "$1 is not an existing list"
exit 0
else
OLD=$1
NEW=$2
mv ${MMHOME}/lists/${OLD} ${MMHOME}/lists/${NEW}
mv ${MMHOME}/archives/private/${OLD} ${MMHOME}/archives/private/${NEW}
mv ${MMHOME}/archives/private/${OLD}.mbox ${MMHOME}/archives/private/${NEW}.mbox
mv ${MMHOME}/archives/private/${NEW}.mbox/${OLD}.mbox ${MMHOME}/archives/private/${NEW}.mbox/${NEW}.mbox
# if you use Exim, this might be useful
echo "${OLD}:\t\t\t${NEW}@lists.euroburners.net" >> /etc/exim/virtual/lists.euroburners.net
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment