[Mimedefang] Stop/restart leaves mimedefang processes

Ashley M. Kirchner ashley at pcraft.com
Tue Apr 8 11:59:01 EDT 2003

Stefan Schoeman wrote:

>I've had this hassle for quite some time and then just decided to modify the
>scripts to kill MIMEDefang with signal 9 (QUIT). This seems to kill the
>processes but I've always been concerned that it maybe does not clean all
>the memory that the applications may have consumed.
>David, could you please shed some light on whether killing MIMEDefang
>processes with signal 9 could lead to memory leakage ?
    I've been killing MIMEdefang on my Red Hat gateways via the 
'killproc' routine (which is part of /etc/init.d/functions) for a long 
while now without any adverse results.  killproc basically does a few 

    a) Check to see if you've specified a kill level:
         # check for second arg to be kill level
         if [ "$2" != "" ] ; then

    b) Then it finds the pid(s).  Note that the 'pidofproc' is a routine 
that scans for either /var/run/${base}.pid, and failing that it will run 
'pidof -o $$ -o $PPID -o %PPID -x ${base}' - this will effectively 
result in $pid containing all the pids for all the MIMEdefang processes.

         # Save basename.

         # Find pid.
         pid=`pidofproc $1`
         if [ -z "${pid:-}" ] ; then
           pid=`pidofproc $base`

    c) Now for the kill.  If you did specify a kill level, it will run 
with that, otherwise it will try to TERMinate the processes first.  If 
that fails, it KILLs them:

         if [ "$notset" -eq "1" ] ; then
           if checkpid $pid 2>&1; then
             # TERM first, then KILL if not dead
             kill -TERM $pid
             usleep 100000
             if checkpid $pid && sleep 1 &&
               checkpid $pid && sleep 3 &&
               checkpid $pid ; then
               kill -KILL $pid
               usleep 100000
         # use specified level only
           if checkpid $pid >/dev/null 2>&1; then
             kill $killlevel $pid

    I haven't had any problems starting/shutting down MD for as long as 
I can remember.  Every time, it kills everything.  It's all done from 
within my sendmail init script.  I believe I may have submitted the 
whole script once to David, but I don't know if he ever used it, or used 
parts of it.  If anyone wants to get a copy of my script, let me know. 
 I'm not going to post it to the list because it's rather spammy (201 
lines long).

H| I haven't lost my mind; it's backed up on tape somewhere.
  Ashley M. Kirchner <mailto:ashley at pcraft.com>   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A. 

More information about the MIMEDefang mailing list