[Mimedefang] HUGE problem with mimedefang

James Ebright jebright at esisnet.com
Thu Apr 21 14:08:29 EDT 2005


On Thu, 21 Apr 2005 11:27:44 -0400, Lisa Casey wrote
> status is not an option to /etc/init.d/mimedefang 
> on my system:
> 
> [root at Raydeus-Dee init.d]# /etc/init.d/mimedefang
> Usage: /etc/init.d/mimedefang {start|stop|restart|reread|reload}

It is part of the redhat init script included with the tarball but you can
easily duplicate it on other systems, I just ripped this out of the redhat
init.d functions library (add this to your init.d/mimedefang):

status() {
        local base=${1##*/}
        local pid

        # Test syntax.
        if [ "$#" = 0 ] ; then
                echo $"Usage: status {program}"
                return 1
        fi

        # First try "pidof"
        pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
             pidof -o $$ -o $PPID -o %PPID -x ${base}`
        if [ -n "$pid" ]; then
                echo $"${base} (pid $pid) is running..."
                return 0
        fi

        # Next try "/var/run/*.pid" files
        if [ -f /var/run/${base}.pid ] ; then
                read pid < /var/run/${base}.pid
                if [ -n "$pid" ]; then
                        echo $"${base} dead but pid file exists"
                        return 1
                fi
        fi
        # See if /var/lock/subsys/${base} exists
                return 2
        fi
        echo $"${base} is stopped"
        return 3
}

Then add the following section to use the above function:

status)
    status $prog
    status $prog-multiplexor
    RETVAL=$?
    if [ $RETVAL = 0 -a -x $PROGDIR/md-mx-ctrl ] ; then
        $PROGDIR/md-mx-ctrl -s $MX_SOCKET barstatus
    fi
    ;;

$PROGDIR and $prog are set at top of mimedefang init.d script and RETVAL is
initialized as 0 ($prog is mimedefang and $PROGDIR is where it is installed)

Also, I find that you should test for and remove any stale locks in the script
(I do in my version that has been in production for about a year now). In
Davids script add it after the sleep, something like:

if [ -e /var/lock/subsys/mimedefang ]; then \
  /bin/rm -f /var/lock/subsys/mimedefang
fi

Also I find the script to be more readable using square brackets instead of
the test keyword and since you are testing for not 0 it can be shortened to:

if [ $? ]; then \
 .....

fi


Another item that this script will not catch and using the redhat status code
will not catch or remedy are hung md processes... they will cause a failure if
not killed off using a kill -9 (note, I have only seen old hung processes on
two systems.. both of which get slammed by blackberries so I suspect it is a
high load or large number of children issue, in bursts, and have worked around
the issue and not really been able to spend the time needed to analyze why).

Jim
--
EsisNet.com Webmail Client




More information about the MIMEDefang mailing list