Sympa tip: changing domains

As many of my readers likely know by now, my organization ONE/Northwest has just rebranded itself as Groundwire.  Obviously, our domain name changed, and with it our email addresses.  One of the many “switchover” tasks we faced was the challenge of updating our email addresses on the many Sympa-powered email lists we host.

The obvious solution is to have each user log in one-by-one and change their email address in the Sympa web UI.  This has two major disadvantages, though:

1) It’s a real pain for 2o+ users to log in and update their addresses

2) That would only affect list subscriptions, not list configurations such as owners and moderators, because Sympa doesn’t yet stores this configuration info in its database; it’s still stored in a text-based config file on the filesystem.  Ugh.

So, in the end, a twofold approach was necessary.  Here’s what I did.

Updating list subscribers in Sympa’s MySQL database

I used SQLyog, a popular Windows-based GUI front-end to MySQL.  (You could also use PHPmyadmin on your server to provide a web interface.)  I did the following queries to update onenw.org to groundwire.org in all user emails.

update user_table set user_email = replace(user_email, 'onenw.org', 'groundwire.org');
update subscriber_table set user_subscriber = replace(user_subscriber, 'onenw.org', 'groundwire.org');
update admin_table set user_admin = replace(user_admin, 'onenw.org', 'groundwire.org');

Updating list owners/moderators in Sympa’s filesystem-based config files

Sympa stores list owners and moderators in a plain-text file on the filesystem.  Here’s how I mass-updated it.

On the server command line, I navigated to sympa’s expl folder at /home/sympa/expl.  This directory contains one subdirectory for each list, and each list contains a “config” file.

I executed the command:

find . -name config | xargs perl -p -ie 's/onenw\.org/groundwire\.org/g'

This took a couple of minutes to iterate over a little more than 1000 lists.  Not blazing fast, but not too horrible.

I think a great feature addition to Sympa would be a script that would take either one email or one domain as an input, and execute these commands in parallel.

3 thoughts on “Sympa tip: changing domains”

  1. Remember that a period in a regular expression means “match any character”, so you probably want ‘s/onenw.org/groundwire.org/g’ (in this case it’s probably unlikely that you had cases with onenwXorg for some X other than a period, but still…)

    Also, it’s worth noting that with perl’s inplace substitution you can optionally specify an extension for backup copies of the original files…e.g. perl -pi.bak -e etc…

  2. Gah, wordpress stripped my backslash out of that comment. There should be a backslash before the period in “onenw.org” within the regular expression.

  3. Thanks, David, post is fixed. FYI, I think my actual replace was just onenw/groundwire, but I realized after the fact that I should probably be more precise here.

Comments are closed.