ports/66147: ports/mail/spamass-milter startup script is wrong
Helge Oldach
spamass-milter-may04 at oldach.net
Sat May 1 14:30:15 UTC 2004
>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 at 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:
More information about the freebsd-ports-bugs
mailing list