From jgh@experts-exchange.com  Mon Sep 13 19:30:25 2010
Return-Path: <jgh@experts-exchange.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 62A35106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Sep 2010 19:30:25 +0000 (UTC)
	(envelope-from jgh@experts-exchange.com)
Received: from mail.experts-exchange.com (mail.experts-exchange.com [72.29.183.251])
	by mx1.freebsd.org (Postfix) with ESMTP id 409468FC16
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Sep 2010 19:30:25 +0000 (UTC)
Received: from mail.experts-exchange.com (localhost [127.0.0.1])
	by mail.experts-exchange.com (Postfix) with ESMTP id D79B6F2F2AA
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Sep 2010 12:30:24 -0700 (PDT)
Received: from mail.experts-exchange.com ([127.0.0.1])
	by mail.experts-exchange.com (mail.experts-exchange.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id p6m7n-mTzvlE for <FreeBSD-gnats-submit@freebsd.org>;
	Mon, 13 Sep 2010 12:30:24 -0700 (PDT)
Received: from eggman.experts-exchange.com (unknown [192.168.103.122])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	(Authenticated sender: jhelfman)
	by mail.experts-exchange.com (Postfix) with ESMTPSA id 97CEBF2F347
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 13 Sep 2010 12:30:23 -0700 (PDT)
Received: by eggman.experts-exchange.com (sSMTP sendmail emulation); Mon, 13 Sep 2010 12:27:43 -0700
Message-Id: <20100913193024.D79B6F2F2AA@mail.experts-exchange.com>
Date: Mon, 13 Sep 2010 12:27:43 -0700
From: Jason <jgh@experts-exchange.com>
Reply-To: Jason <jgh@experts-exchange.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] www/tomcat55 rc script doesn't properly handle status/stop once service is started
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 13 19:40:01 UTC 2010
>Closed-Date:    Wed Sep 15 12:18:22 UTC 2010
>Last-Modified:  Wed Sep 15 12:18:22 UTC 2010
>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@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:
Responsible-Changed-From-To: freebsd-ports-bugs->pgollucci 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Sep 14 18:54:46 UTC 2010 
Responsible-Changed-Why:  
pgollucci@ wants this category PRs (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150538 
Responsible-Changed-From-To: pgollucci->freebsd-ports-bugs 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Tue Sep 14 19:40:12 UTC 2010 
Responsible-Changed-Why:  
back to pool, I do not want this port prs 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150538 
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-python 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Tue Sep 14 19:40:37 UTC 2010 
Responsible-Changed-Why:  
back to python, I do not want this port prs 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150538 
Responsible-Changed-From-To: freebsd-python->freebsd-ports-bugs 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Tue Sep 14 19:41:12 UTC 2010 
Responsible-Changed-Why:  
back to pool, I do not want this port prs 

http://www.freebsd.org/cgi/query-pr.cgi?pr=150538 
State-Changed-From-To: open->closed 
State-Changed-By: pav 
State-Changed-When: Wed Sep 15 12:18:13 UTC 2010 
State-Changed-Why:  
superceeded by 150576 

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