#!/bin/sh

. /etc/rc.common

StartService ()
{
    if [ "${MAILMAN:=-NO-}" = "-YES-" ]; then
	ConsoleMessage "Starting Mailman mailing list services"
	/usr/share/mailman/bin/mailmanctl -s start
    fi
}

StopService ()
{
    ConsoleMessage "Stopping Mailman mailing list services"
    /usr/share/mailman/bin/mailmanctl stop
}

RestartService ()
{
    if [ "${MAILMAN:=-NO-}" = "-YES-" ]; then
	ConsoleMessage "Reloading Mailman configuration"
	if ! /usr/share/mailman/bin/mailmanctl restart; then
	    StartService
	fi
    else
	StopService
    fi
}

RunService "$1"
