How to Do Basic Things with MAILMAN from Command Line (Even if using Plesk)


In that case you need to

  1. Get a List into Text Format: dump the list from the command line (see command line scripts below) /usr/lib/mailman/bin/  ./list_members -o filename.txt listname (i.e. #./list_members -o cal.txt cal) 
  2. Move a List to another Server: Do Step #1 with EACH List; then copy all list config files from command line (lists located in /var/lib/mailman/lists) Be SURE to NOT store in a sub-directory of EXISTING list directory **Note - please read important mailman information below to understand where these files are located; you can tar them up if you know how.
  3. Fix an Error in the Web Interface - run ./checkperms -f from /usr/lib/mailman/bin
  4. Reset a List Password - run ./change_password -l listname -p newpassword
    TEST, if this Fails to let you into the list then:
    1. remove the list (either command-line or plesk) - For command line cd /usr/lib/mailman/bin/ and
      then run # ./rmlist listname (# is the root prompt, don’t type it)
    2. re-create the list (either command-line or plesk)
    3. Put list files back (created in step #2) into newly created list directory
    4. run check_perms -f on entire mailman install (/usr/lib/mailman/bin ./check_perms -f)

Important Mailman Information:

    List config data (not actual lists) are located at /var/lib/mailman
    Folders at that location:
        -archives (all sent emails)
        -data (current data files)
        -lists (all lists in sub directories)
            Example: cal directory
            - config.pck - configuration data in pickle format (critical file for setup)
            - config.pck.last - last config (always backed up when config is updated)
            - pending.pck - pending requests (not necessary when moving/creating)
            - request.pck - similar to pending (not necessary when moving/creating)
        - spam (spam settings / data)

**NOTE: there is NO file in this area that contains the “list” data. That is stored in a central repository and MUST be dumped from command line scripts (see below or step #1 above)
    
Command line scripts

NOTE: scripts under linux are run from /usr/lib/mailman/bin (login as root; cd /usr/lib/mailman/bin) then scripts are run from command line like this: # ./check_perms [option]

This is a brief overview of the current crop of command line scripts available to the site administrator in the bin directory. For more details, run the script with the --help option, which will print out the usage synopsis. You must run these scripts from the bin directory in the Mailman installation location, usually /home/mailman.

add_members
Use this script to mass add members to a mailing list. Input files are plain text, with one address per line. Command line options allow you to add the addresses as digest or regular members, select whether various notification emails are sent, and choose which list to add the members to.

arch
Use this to rebuild a list’s archive. This script can’t be used to modify a list’s raw mbox file, but once you’ve edited the mbox file some other way, you can use this script to regenerate the HTML version of the on-line archive.

change_pw
Use this to change the password for a specific mailing list.

check_db
Use this script to check the integrity of a list’s config.pck and config.pck.last database files.

check_perms
Use this script to check, and optionally fix, the permissions of the various files in a Mailman installation.

clone_member
Use this script to clone an address on a particular list into different address. This is useful when someone is changing email addresses and wants to keep all their old configuration options. Eventually members will be able to do their own cloning, but for now, only the site administrator can do this. Command line options let you remove the old address, clone addresses in the list managers addresses, etc.

config_list
This is a very powerful script which lets you view and modify a list’s configuration variables from the command line. E.g. you can dump out all the list options into a plain text file (actually a valid Python file!), complete with comments explaining each variable. Or you can apply the configuration from such a file to a particular list.
Where this might be useful is if you wanted to change the web_page_url attribute on every list. You could create a file containing only the line
web_page_url = ‘http://www.mynewsite.com/mailman-relocated/
and then feed this file back to config_list for every list on your system. config_list only sets the list variables that it finds in the input file.

digest_arch
This script is deprecated.

dumpdb
This script dumps the plain text representation for any .db database file. These files usually contain Python marshaled dictionaries, and can be found in the qfiles directory, thelists/listname directory, etc. This script can also be used to print out the contents of a pickled message file, which are stored in .pck files.

find_member
Use this script to search all the lists, or some subset of lists, for an address matching a regular expression. command line options let you also search the list managers as well.

genaliases
Use this script to regenerate the plain text and db alias files for Postfix (if you’re using Postfix as your MTA).

list_admins
List all the owners of a mailing list.

list_lists
List all, or some subset of, the mailing lists in the system.

list_members
List the members of a mailing list. Command line options let you print just the regular or just the digest members, print the case-preserved addresses of the members, etc.

mailmanctl
The main qrunner control script. Use this to start, stop, and restart the qrunner.

mmsitepass
Use this script to set the site password, which can be used anywhere in the system a list or user password can be used. Essentially, the site password trumps any other password, so choose wisely!

move_list
Use this script when you move Mailman to a new installation location.

newlist
Use this script to create new mailing lists.

qrunner
Use this to run a single qrunner once (for debugging).

remove_members
Use this list to remove members from a mailing list.

rmlist
Use this script to remove a mailing list. By default, a list’s archives are not removed unless the --archives option is given.

sync_members
Use this to synchronize mailing lists in a list’s database with a plain text file of addresses, similar to what is used for add_members. In a sense, this script combines the functionality ofadd_members and remove_members. Any addresses in the file that are not present in the list roster are added, and any addresses in the roster that are not present in the file are removed.
Command line options let you send various notification emails, preview the changes, etc.

update
Don’t use this script manually; it is used as part of the installation and upgrade procedures.

version
Prints the Mailman version number.

withlist
This is the most powerful and flexible script in Mailman. With it you can do all manner of programmatic changes to mailing lists, or look at and interactively inspect almost any aspect of Mailman. By default, you run this using Python’s interactive prompt, like so:
% cd /home/mailman
% python -i bin/withlist mylist
Loading list: mylist (unlocked)


Comments

Please login to comment