ports/181298: mail/mailman: Implement "status" for rc.d script

Oliver Fromme olli at secnetix.de
Wed Aug 14 15:40:02 UTC 2013


>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:


More information about the freebsd-ports-bugs mailing list