Common Mailman administrative tasks

This advanced article describes how to perform some common Mailman tasks:

Reset Mailman to defaults

  1. Make sure that Mailman is not running. Mailman can be stopped in Terminal with this command:
    sudo /usr/share/mailman/bin/mailmanctl stop

    If Mailman is not running, it is OK if a message such as this appears:
    "PID unreadable in: /private/var/mailman/data/master-qrunner.pid
    [Errno 2] No such file or directory: '/private/var/mailman/data/master-qrunner.pid'Is qrunner even running?
    "

  2. Move the existing Mailman database directory. In Terminal:
    sudo mv /var/mailman /var/mailman.old	 		 
  3. Create new mailman database directory and sub-directories with these Terminal commands:

    • sudo mkdir /var/mailman
    • sudo mkdir /var/mailman/archives
    • sudo mkdir /var/mailman/archives/private
    • sudo mkdir /var/mailman/archives/public
    • sudo mkdir /var/mailman/data
    • sudo mkdir /var/mailman/lists
    • sudo mkdir /var/mailman/locks
    • sudo mkdir /var/mailman/logs
    • sudo mkdir /var/mailman/qfiles
    • sudo mkdir /var/mailman/spam

  4. Set permissions on newly-created directories with this Terminal command:
    sudo /usr/share/mailman/bin/check_perms -f
  5. Restart Mailman's master qrunner by running the following command.
    sudo /usr/share/mailman/bin/mailmanctl start

Back up Mailman data

  1. Make sure that Mailman is not running. Mailman can be stopped in Terminal with this command:
    sudo /usr/share/mailman/bin/mailmanctl stop

    If Mailman is not running, it is OK if a message such as this appears:
    "PID unreadable in: /private/var/mailman/data/master-qrunner.pid
    [Errno 2] No such file or directory: '/private/var/mailman/data/master-qrunner.pid'Is qrunner even running?
    "

  2. Execute this Terminal command, replacing the target path as desired:

    ditto -c -z /var/mailman
    (Path_to_backup_file)

  3. Restart Mailman's master qrunner with the following command.
    sudo /usr/share/mailman/bin/mailmanctl stop 		

Restore from a Mailman backup

  1. Make sure that Mailman is not running. Mailman can be stopped in Terminal with this command:
    sudo /usr/share/mailman/bin/mailmanctl stop

    If Mailman is not running, it is OK if a message such as this appears:
    "PID unreadable in: /private/var/mailman/data/master-qrunner.pid
    [Errno 2] No such file or directory: '/private/var/mailman/data/master-qrunner.pid'Is qrunner even running?
    "

  2. Move the existing Mailman database directory via Terminal:

    sudo mv /var/mailman /var/mailman.old

  3. Restore from a backup with this command:

    ditto -x (Path_to_backup_file) /var/mailman

    Note that there is a space after -x and before /var.

  4. Set permissions on newly created directories with:

    sudo /usr/share/mailman/bin/check_perms -f

  5. Restart Mailman's master qrunner by running the following command:

    sudo /usr/share/mailman/bin/mailmanctl stop

Migrating from one server to another

  1. Log in to the new Mailman server as root (or "sudo -s" to become root).
  2. Make sure that Mailman is not running. Mailman can be stopped in Terminal with this command:
    sudo /usr/share/mailman/bin/mailmanctl stop
  3. If Mailman is not running, it is OK if a message such as this appears:
    "PID unreadable in: /private/var/mailman/data/master-qrunner.pid
    [Errno 2] No such file or directory: '/private/var/mailman/data/master-qrunner.pid'Is qrunner even running?
    "

  4. Run the following Terminal command, replacing (FQDN) with the fully qualified domain name of the previous Mailman server.

    ssh (FQDN) ditto -c /var/mailman - | ditto -x - /var/mailman

    This will copy the mailman data to the new server over an ssh connection.

  5. Set permissions on newly-created directories with:

    sudo /usr/share/mailman/bin/check_perms -f

  6. Log in to the new Mailman server as an administrator and execute the following Terminal command on a single line. (FQDN) with the fully qualified domain name of the new Mailman server. This will change the URL information for the mailing lists to the new server's fully qualified domain name.
sudo /usr/share/mailman/bin/list_lists -b | xargs -I'{}' sudo /usr/share/mailman/bin/withlist -l -r fix_url '{}' -u (FQDN) -v
 
  1. Restart Mailman's master qrunner by running the following command.

    sudo /usr/share/mailman/bin/mailmanctl start
Published Date: Feb 20, 2012