[Mailman-Users] BASH list renaming script

Ron King rking at mro.nmt.edu
Fri May 22 20:56:28 CEST 2009


I work with academics, who seem to find perverse joy in needing to 
reorganize everything at least once a year.  I wanted to post this 
somewhere before I lose it.  The script renames a list from the command 
line, without having to do anything from the web GUI.  It has always 
worked for me. 

Instructions:
Stop mail service. # add this to the script so you don't need to 
remember to do it
./rename_list.sh oldListName NewListName  # the names are usually all 
lowercase, JIC you get file/list not found errors.
Start mail service. # add this to the script so you don't need to 
remember to do it

rename_list.sh contents:
#!/bin/bash
OLD=$1
NEW=$2
#service zimbra stop # zimbra being our mail program
service mailman stop
test -a /var/lib/mailman/archives/private/${NEW} && echo "*** That 
mailing list name already exists. *** "
mv /var/lib/mailman/lists/${OLD} /var/lib/mailman/lists/${NEW}
mv /var/lib/mailman/archives/private/${OLD} 
/var/lib/mailman/archives/private/${NEW}
mv /var/lib/mailman/archives/private/${OLD}.mbox 
/var/lib/mailman/archives/private/${NEW}.mbox
mv /var/lib/mailman/archives/private/${NEW}.mbox/${OLD}.mbox 
/var/lib/mailman/archives/private/${NEW}.mbox/${NEW}.mbox
/usr/lib/mailman/bin/arch --wipe ${NEW}
echo "real_name = '$NEW'" > temp.txt
echo "subject_prefix = '[$NEW]'" >> temp.txt
/usr/lib/mailman/bin/config_list -i temp.txt $NEW
rm temp.txt -f
/usr/lib/mailman/bin/genaliases
service mailman start
#service zimbra start

-- 
Ron King
IT Manager
Magdalena Ridge Observatory - New Mexico Tech
101 East Rd - Socorro, NM 87501
575-835-5772 phone - 878-835-6807 fax
rking at mro.nmt.edu



More information about the Mailman-Users mailing list