Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 May 2004 16:21:03 +0200 (CEST)
From:      Helge Oldach <spamass-milter-may04@oldach.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        spamass-milter-may04@oldach.net
Subject:   ports/66147: ports/mail/spamass-milter startup script is wrong
Message-ID:  <200405011421.i41EL3b5008319@sep.oldach.net>
Resent-Message-ID: <200405011430.i41EUFin069140@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         66147
>Category:       ports
>Synopsis:       ports/mail/spamass-milter startup script is wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 01 07:30:14 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Helge Oldach
>Release:        FreeBSD 4.10-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD localhost 4.10-PRERELEASE FreeBSD 4.10-PRERELEASE #1838: Sun Apr 25 00:32:25 CES
T 2004 toor@localhost:/usr/obj/usr/src/sys/GENERIC i386

	
>Description:

/usr/local/etc/rc.d/spamass-milter.sh is wrong:

                "${DAEMON}" -p "${SOCKET}" -f &
                echo $! > "${PIDFILE}"

$! is the PID of the last command that /bin/sh put into background. But
since spamass-milter forks itself (-f option) this is *not* the PID of
the running spamass-milter process. Hence the PID file contains the PID
of a nonexistant process and cannot be used to stop spamass-milter.

>How-To-Repeat:
	
>Fix:

Use the ./spamass-milter.sh script that is included already in the
distribtution.

Alternatively, apply the following patch, which will not create a PID
file:

--- spamass-milter.sh.dist	Wed Feb 18 20:38:01 2004
+++ spamass-milter.sh	Sat May  1 15:49:11 2004
@@ -2,28 +2,22 @@
 
 DAEMON=/usr/local/sbin/spamass-milter
 SOCKET=/var/run/spamass-milter.sock
-PIDFILE=/var/run/spamass-milter.pid
 
 case "$1" in
 start)
 	if [ -f "${DAEMON}" -a -x "${DAEMON}" ]
 	then
-		"${DAEMON}" -p "${SOCKET}" -f &
-		echo $! > "${PIDFILE}"
+		"${DAEMON}" -p "${SOCKET}" -f
 		sleep 1
 		kill -HUP `head -1 /var/run/sendmail.pid`
 		echo -n ' spamass-milter'
 	fi
 ;;
 stop)
-	if [ -f "${PIDFILE}" ]
-	then
-		read -r pid junk < "${PIDFILE}"
-		kill ${pid}
-		rm -f "${SOCKET}" "${PIDFILE}"
-		sleep 1
-		kill -HUP `head -1 /var/run/sendmail.pid`
-		echo -n ' spamass-milter'
-	fi
+	killall $(basename ${DAEMON})
+	rm -f "${SOCKET}"
+	sleep 1
+	kill -HUP `head -1 /var/run/sendmail.pid`
+	echo -n ' spamass-milter'
 ;;
 esac
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405011421.i41EL3b5008319>