I was able to reproduce this bug on amavisd-new 20030616p10-5.  It
occurred when i commented out the name of the pid file in
/etc/amavis/amavisd.conf and tried to restart amavisd.  Because
/etc/init.d/amavis assumes that the pid file is the same as what is set
in /etc/amavis/amavisd.conf by default.  Attached is a suggested patch
to /etc/init.d/amavis and an example /etc/default/amavisd.

This is a non-ideal solution in that it requires manual intervention.  I
played with a script to automatically parse /etc/amavis/amavisd.conf
appropriately, but i couldn't get one working to my satisfaction.  (On
that note, if anyone can tell me how to source a perl-syntax config file
without running afoul of variable scoping, i'd really like to know!  :-)

Paul
--- /etc/init.d/amavis	2004/12/01 01:55:56	1.1
+++ /etc/init.d/amavis	2005/04/16 03:25:17
@@ -16,11 +16,16 @@
 DESC=amavisd
 PARAMS=""

+if [ -r "/etc/default/${DAEMONNAME}" ]; then
+    . "/etc/default/${DAEMONNAME}"
+fi
+PIDFILE=${PIDFILE:-"/var/run/amavis/${NAME}.pid"}
+
 test -f ${DAEMON} || exit 0

 set -e

-START="--start --quiet --pidfile /var/run/amavis/${NAME}.pid --name ${DAEMONNAME} --startas ${DAEMON} -- ${PARAMS}"
+START="--start --quiet --pidfile ${PIDFILE} --name ${DAEMONNAME} --startas ${DAEMON} -- ${PARAMS}"

 createdir() {
 # $1 = user
@@ -71,7 +76,7 @@
 	;;
   stop)
 	echo -n "Stopping $DESC: "
-	if start-stop-daemon --stop --quiet --pidfile /var/run/amavis/$NAME.pid \
+	if start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" \
 		--name $DAEMONNAME --retry 10 >/dev/null ; then
 		echo "amavisd-new."
 		cleanup
@@ -87,8 +92,8 @@
 	;;
   reload)
 	echo "Reloading $DESC configuration files."
-	start-stop-daemon --stop --signal 1 --quiet --pidfile \
-		/var/run/amavis/$NAME.pid --name $DAEMONNAME
+	start-stop-daemon --stop --signal 1 --quiet --pidfile "${PIDFILE}" \
+		--name $DAEMONNAME
   	;;
   restart|force-reload)
 	$0 stop
# This file is sourced from /etc/init.d/amavis. If you change the pid file
# in /etc/amavis/amavisd.conf, you must change it here also.
PIDFILE="/var/run/amavis/${NAME}.pid"

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to