ports/150538: [patch] www/tomcat55 rc script doesn't properly handle status/stop once service is started

Jason jgh at experts-exchange.com
Mon Sep 13 19:40:02 UTC 2010


>Number:         150538
>Category:       ports
>Synopsis:       [patch] www/tomcat55 rc script doesn't properly handle status/stop once service is started
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 19:40:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Jason
>Release:        FreeBSD 7.3-RELEASE-p1 i386
>Organization:
>Environment:
System: FreeBSD eggman.experts-exchange.com 7.3-RELEASE-p1 FreeBSD 7.3-RELEASE-p1 #0: Wed May 26 04:29:05 UTC 2010 root at i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
	tomcat55 doesn't properly handle status/stop once service is started

>How-To-Repeat:
install www/tomcat55
/usr/local/etc/rc.d/tomcat55 start
/usr/local/etc/rc.d/tomcat55 status ( should show not running)
/usr/local/etc/rc.d/tomcat55 stop ( should show not running and to check pid file )

>Fix:

--- tomcat55/files/tomcat55.sh.in	2010-09-13 12:06:46.000000000 -0700
+++ tomcat55/files/tomcat55.sh.in	2010-09-13 12:10:06.000000000 -0700
@@ -123,6 +123,7 @@
 
 start_precmd=pid_touch
 stop_cmd="tomcat%%TOMCAT_VERSION%%_stop"
+status_cmd="tomcat%%TOMCAT_VERSION%%_status"
 
 pid_touch ()
 {
@@ -133,9 +134,9 @@
 tomcat%%TOMCAT_VERSION%%_stop() {
 	rc_pid=$(check_pidfile $pidfile $procname)
 
-	if [ -z "$rc_pid" ]; then
-		[ -n "$rc_fast" ] && return 0
-		if [ -n "$pidfile" ]; then
+	if [ -z `cat $pidfile` ]; then
+		[ -n `cat $pidfile` ] && return 0
+		if [ -n `cat $pidfile` ]; then
 			echo "${name} not running? (check $pidfile)."
 		else
 			echo "${name} not running?"
@@ -145,11 +146,20 @@
 	
 	echo "Stopping ${name}."
 	${java_command} stop
-	tomcat_wait_max_for_pid ${tomcat%%TOMCAT_VERSION%%_stop_timeout} ${rc_pid}
+	tomcat_wait_max_for_pid ${tomcat%%TOMCAT_VERSION%%_stop_timeout} `cat $pidfile`
 	kill -KILL ${rc_pid} 2> /dev/null && echo "Killed."
 	echo -n > ${pidfile}
 }
 
+tomcat%%TOMCAT_VERSION%%_status() {
+	if [ -z `cat $pidfile` ]; then
+	  echo "${name} is not running."
+	  return 1
+	else
+	  echo "${name} is running as pid `cat $pidfile`."
+	fi
+}
+
 tomcat_wait_max_for_pid() {
 	_timeout=$1
 	shift
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list