My work, my ideas, my faith, my life

Mailman

By Rex Goode

I host my websites through jumpline.com and have been generally happy with their service. They respond quickly and helpfully to support requests. I have no real complaints. One area that has been a problem that has not been solved is related to the many mailing lists I host.

Jumpline offers two options for running mailing lists: Majordomo and Mailman. For most of my “career” in dataprocessing, I’ve used Majordomo. It is simple and easy to use. What I have not liked about it is that there is not a visual interface for users to change their own subscription information. This may have changed in recent years, but it did not change quickly enough for me.

I moved all of my mailing lists to Mailman a couple of years ago. Unfortunately, it has a couple of problems that Jumpline support has not been able to solve.

  1. Mailman crashes occasionally on my sites and I don’t know about it until someone on one of my lists asks me what happened to the list. Jumpline support doesn’t know why.
  2. With several lists, there isn’t single interface where I can see what is happening on all lists at the same time.

Crashes

These are very annoying to users. It has caused some of my lists to slow way down in participation. Because I don’t know it has crashed, I can’t restart it.

Interface

On lists where I limit new membership to those who have a legitimate interest in the topic, when someone subscribes, their subscription request goes into a list of pending requests.

Most of my lists are set to only accept email from members and to limit the size of emails, including attachments, to 40K. When someone posts to the list who is not a member or a member posts a very large message, it is held and put in the same list of pending requests as new members.

If I don’t look at that list on a regular basis, I miss things. New members wait many days to be approved and posts that are legitimate may also wait until I get around to checking the pending requests. The problem compounds when I have several lists. Each list has its own separate pending requests. I have no one place I can go to see all requests for all lists.

Solutions

I joined the Mailman users mailing list and asked some questions. The members there, especially a Mark Sapiro and a Dennis Black, helped me solve these two problems.

I still can’t prevent crashes, but now I have a way to quickly see whether the mailing list software is running. On a page I visit multiple times per day, my local home administrative page, I created a script that tells me at the top whether the server is running. If it isn’t, I can easily restart it. In fact, the script itself will usually restart it if it can. If it can’t, I will know to do it manually.

I also created a script that will give me a count of how many requests are pending in each list. It also appears at the top of my home page. When I see any there, I know to go and deal with them.

Technical

You may not care much about this next part. Here are my scripts, with some of the information modified to protect sensitive parts of my server. If you are having the same problems, this should still help you.

First, the following code is written in BASH. My Linux server uses BASH as its scripting language.

Script:

mailmanrestart

Code:

#!/bin/sh
COUNT=`ps -ef | grep path/to/mailman/qrunner | wc -l`
echo $COUNT Mailman processes running
if [ $COUNT -lt 1 ]; then
   /path/to/mailman/mailmanctl -q stop
   /path/to/mailman/mailmanctl -s -q start
   echo 'Mailman stop start done' | mailx -s 'qrunners started' myaddress@mydomain.com
fi

Description:

This checks for processes running on my server called qrunner. It is the name of the main process that runs Mailman. I should have several such processes running if Mailman is up and working. If it isn’t working, the script will stop whatever processes are running and start it up fresh. Then it will send me an email that Mailman was restarted.

And…

Script:

mailmanreqs

Code:

#!/bin/sh
for listname in list1 list2 list3 list4 list5 list6
do
        /path/to/mailman/withlist -l -i $listname << EOF 2> /dev/null
print "%i $listname requests\n" % (m.NumRequestsPending())
EOF
done

Description:

This loops through all of the mailing lists I have named in the “for” command. It prints a message saying how many pending requests there are for that list.

Now, if you are still with me, you will recognize that I would have to log in to Linux and run these BASH scripts every time I wanted to see their results. That will only be slightly more useful than what I have been going through before. I need to execute these scripts on a web page I visit often. That would be my administrative home page where there are links to all sorts of things that I operate.

This page is written in the PHP language. As with the other scripts I presented, I’ve changed some of the path information to protect my server:

<?php

        $mailman = shell_exec("/www/htdocs/private/mailmanrestart");
        echo "<span style='padding-left: 1em;'>$mailman</span>\n";
        $mailman = shell_exec("/www/htdocs/private/mailmanreqs");
        $mmm = split("\n", $mailman);
        $msg = "";
        foreach ($mmm as $m) {
                $mo = preg_replace("/[>][>][>] /", "", $m); // get rid of withlist prompts
                $mos = split(' ', $mo);
                if ($mos[0] != '0') // don't show 0 results
                        if ($mo) $msg .= "<span style='padding-left: 1em'>$mo</span>\n";
        }
        if ($msg) echo "$msg\n";
?>

This first runs the mailmanrestart script. It prints the results to the page. The results should say something like “9 Mailman processes running.” If it ever says something like “0 Mailman processes running”, I will know that I have a problem and should manually restart Mailman.

Then, I run the mailmanreqs script. It returns to me a string with a line for each mailing list that says how many requests are pending for each list. I don’t really care about 0 pending requests for a list, so I only show the ones that have a number other than 0.  It will say something like, “1 list1 requests     4 list2 requests”.

Both of these message prominently display in a place that I will likely see them within a few hours. I hope this will solve the problems I have been having with my Mailman lists and give my users more confidence in using them.

Be the first to like.

Leave a Reply

If your comment is a support question, please post it at the forums.