Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Aug 2013 17:37:58 +0200 (CEST)
From:      Oliver Fromme <olli@secnetix.de>
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        Oliver Fromme <olli@secnetix.de>
Subject:   ports/181298: mail/mailman: Implement "status" for rc.d script
Message-ID:  <201308141537.r7EFbwup000718@grabthar.secnetix.de>
Resent-Message-ID: <201308141540.r7EFe1GL034111@freefall.freebsd.org>

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

>Number:         181298
>Category:       ports
>Synopsis:       mail/mailman: Implement "status" for rc.d script
>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:   Wed Aug 14 15:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Fromme
>Release:        FreeBSD 9.1-STABLE-20130621 i386
>Organization:
secnetix GmbH & Co. KG
		http://www.secnetix.de/bsd
>Environment:
	n/a
>Description:

The rc.d script provided with the mailman port doesn't
support a "status" argument.  The patch below adds this.

>How-To-Repeat:

Without the patch:

    # service mailman status
    /usr/local/etc/rc.d/mailman: unknown directive 'status'.
    Usage: /usr/local/etc/rc.d/mailman [fast|force|one|quiet](start|stop|restart|rcvar|reload)

With the patch applied:

    # service mailman status
    mailman is running as pid 38369.
    # echo $?
    0
    # service mailman stop
    # service mailman status
    mailman is not running.
    # echo $?
    1

>Fix:

Apply the following patch to ports/mail/mailman/files/mailman.in:

--- mailman.in.orig	2012-07-14 15:54:48.000000000 +0200
+++ mailman.in	2013-08-14 17:29:02.000000000 +0200
@@ -23,7 +23,8 @@
 
 start_cmd=${name}_start
 stop_cmd=${name}_stop
-extra_commands="reload"
+status_cmd=${name}_status
+extra_commands="reload status"
 
 mailman_start() {
 	%%MAILMANDIR%%/bin/mailmanctl -s -q start
@@ -35,4 +36,15 @@
 	  || echo ${name} not running? \(check ${pidfile}\)
 }
 
+mailman_status() {
+	local retcode=0
+	if [ -f $pidfile ] && ps -p $(cat $pidfile) > /dev/null; then
+		echo $name is running as pid $(cat $pidfile).
+	else
+		echo $name is not running.
+		retcode=1
+	fi
+	return $retcode
+}
+
 run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



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