From hmo@sep.oldach.net  Sat May  1 07:21:13 2004
Return-Path: <hmo@sep.oldach.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0860116A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  1 May 2004 07:21:13 -0700 (PDT)
Received: from sep.oldach.net (sep.oldach.net [194.180.25.6])
	by mx1.FreeBSD.org (Postfix) with ESMTP id B219143D64
	for <FreeBSD-gnats-submit@freebsd.org>; Sat,  1 May 2004 07:21:11 -0700 (PDT)
	(envelope-from hmo@sep.oldach.net)
Received: from sep.oldach.net (localhost [127.0.0.1])
	by sep.oldach.net (8.12.11/8.12.11/hmo03mar03) with ESMTP id i41EL3ee008320
	(version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO);
	Sat, 1 May 2004 16:21:04 +0200 (CEST)
	(envelope-from hmo@sep.oldach.net)
Received: (from hmo@localhost)
	by sep.oldach.net (8.12.11/8.12.11/Submit) id i41EL3b5008319;
	Sat, 1 May 2004 16:21:03 +0200 (CEST)
	(envelope-from hmo)
Message-Id: <200405011421.i41EL3b5008319@sep.oldach.net>
Date: Sat, 1 May 2004 16:21:03 +0200 (CEST)
From: Helge Oldach <spamass-milter-may04@oldach.net>
Reply-To: Helge Oldach <spamass-milter-may04@oldach.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: spamass-milter-may04@oldach.net
Subject: ports/mail/spamass-milter startup script is wrong
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 01 07:30:14 PDT 2004
>Closed-Date:    Mon May 24 15:46:51 PDT 2004
>Last-Modified:  Mon May 24 15:46:51 PDT 2004
>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:
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Mon May 24 15:46:45 PDT 2004 
State-Changed-Why:  
Committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=66147 
>Unformatted:
