From jonc@chen.org.nz  Sun Sep 21 19:20:04 2003
Return-Path: <jonc@chen.org.nz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7969516A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 21 Sep 2003 19:20:04 -0700 (PDT)
Received: from chen.org.nz (chen.org.nz [210.54.19.51])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 9C0D543FBD
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 21 Sep 2003 19:20:03 -0700 (PDT)
	(envelope-from jonc@chen.org.nz)
Received: by chen.org.nz (Postfix, from userid 1000)
	id C3EB01364C; Mon, 22 Sep 2003 14:20:02 +1200 (NZST)
Message-Id: <20030922022002.C3EB01364C@chen.org.nz>
Date: Mon, 22 Sep 2003 14:20:02 +1200 (NZST)
From: Jonathan Chen <jonc@chen.org.nz>
Reply-To: Jonathan Chen <jonc@chen.org.nz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rc.sendmail needs to honour ${sendmail_msp_queue_enable} on stop
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         57075
>Category:       conf
>Synopsis:       rc.sendmail needs to honour ${sendmail_msp_queue_enable} on stop
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gshapiro
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 21 19:30:20 PDT 2003
>Closed-Date:    Thu Oct 30 15:08:57 PST 2003
>Last-Modified:  Thu Oct 30 15:08:57 PST 2003
>Originator:     Jonathan Chen
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD grimoire.chen.org.nz 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #0: Thu Sep 18 20:42:35 NZST 2003 root@grimoire.chen.org.nz:/usr/obj/usr/src/sys/GRIMOIRE i386
>Description:

If we decide to use an MTA other than sendmail, and configure /etc/rc.conf
and mailer.conf to reflect this, the system stop/restart arguments on
rc.sendmail echos out spurious:

	"stop-mspq: /var/spool/clientmqueue/sm-client.pid not found"
or
	"XXXX: No such process"

/etc/rc.sendmail honours ${sendmail_msp_queue} from /etc/rc.conf for
"start", but ignores it for "stop" and "restart".

>How-To-Repeat:

Taking Postfix MTA installation as an example. We make the necessary
changes /etc/mail/mailer.conf and have the following in /etc/rc.conf
(as recommended in the postfix/pkg-message):
 
	sendmail_enable="YES"
	sendmail_flags="-bd"
	sendmail_pidfile="/var/spool/postfix/pid/master.pid"
	sendmail_outbound_enable="NO"
	sendmail_submit_enable="NO"
	sendmail_msp_queue_enable="NO"

As root:

	# sh /etc/rc.sendmail start
	# sh /etc/rc.sendmail stop

>Fix:

Patches for /etc/rc.sendmail:

--- rc.sendmail.orig	Mon Sep 22 14:01:57 2003
+++ rc.sendmail	Mon Sep 22 14:05:32 2003
@@ -122,22 +122,34 @@
 
 stop_mspq()
 {
-	if [ -r ${sendmail_mspq_pidfile} ]; then
-		echo -n ' sendmail-clientmqueue'
-		kill -TERM `head -1 ${sendmail_mspq_pidfile}`
-	else
-		echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
-	fi
+	case ${sendmail_msp_queue_enable} in
+	[Yy][Ee][Ss])
+		if [ -r ${sendmail_mspq_pidfile} ]; then
+			echo -n ' sendmail-clientmqueue'
+			kill -TERM `head -1 ${sendmail_mspq_pidfile}`
+		else
+			echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
+		fi
+		;;
+	*)
+		;;
+	esac
 }
 
 restart_mspq()
 {
-	if [ -r ${sendmail_mspq_pidfile} ]; then
-		echo -n ' sendmail-clientmqueue'
-		kill -HUP `head -1 ${sendmail_mspq_pidfile}`
-	else
-		echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
-	fi
+	case ${sendmail_msp_queue_enable} in
+	[Yy][Ee][Ss])
+		if [ -r ${sendmail_mspq_pidfile} ]; then
+			echo -n ' sendmail-clientmqueue'
+			kill -HUP `head -1 ${sendmail_mspq_pidfile}`
+		else
+			echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
+		fi
+		;;
+	*)
+		;;
+	esac
 }
 
 # If no argument is given, assume we are being called at boot time.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gshapiro 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Oct 17 17:51:56 PDT 2003 
Responsible-Changed-Why:  
Assign to sendmail maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57075 
State-Changed-From-To: open->patched 
State-Changed-By: gshapiro 
State-Changed-When: Sat Oct 18 17:32:13 PDT 2003 
State-Changed-Why:  
Thanks.  I've committed a patch which also fixes the MTA case to the 
HEAD.  I'll MFC it after the 4.9 code freeze ends. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57075 
State-Changed-From-To: patched->closed 
State-Changed-By: gshapiro 
State-Changed-When: Thu Oct 30 15:08:39 PST 2003 
State-Changed-Why:  
The fix has been MFC'ed to RELENG_4. 

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