From owner-freebsd-ports-bugs@FreeBSD.ORG Tue Jun 28 20:30:10 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A77381065676 for ; Tue, 28 Jun 2011 20:30:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 84D0B8FC1B for ; Tue, 28 Jun 2011 20:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5SKUAfe056557 for ; Tue, 28 Jun 2011 20:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5SKUAnL056552; Tue, 28 Jun 2011 20:30:10 GMT (envelope-from gnats) Resent-Date: Tue, 28 Jun 2011 20:30:10 GMT Resent-Message-Id: <201106282030.p5SKUAnL056552@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Phil Phillips Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0C18106566C for ; Tue, 28 Jun 2011 20:27:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id B03C38FC0C for ; Tue, 28 Jun 2011 20:27:35 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5SKRZZw035749 for ; Tue, 28 Jun 2011 20:27:35 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p5SKRZXm035748; Tue, 28 Jun 2011 20:27:35 GMT (envelope-from nobody) Message-Id: <201106282027.p5SKRZXm035748@red.freebsd.org> Date: Tue, 28 Jun 2011 20:27:35 GMT From: Phil Phillips To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/158410: [PATCH] www/tomcat55: improve pidfile handling in rc script X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jun 2011 20:30:10 -0000 >Number: 158410 >Category: ports >Synopsis: [PATCH] www/tomcat55: improve pidfile handling in rc 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: Tue Jun 28 20:30:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Phil Phillips >Release: 8.2-RELEASE >Organization: Experts Exchange, LLC >Environment: FreeBSD ip3.experts-exchange.com 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The current rc script for tomcat55 doesn't seem to stop the java process properly. The rc script also oddly handles the pidfile. I reworked the rc script to make sure tomcat stops, and removes the pidfile completely. Included with this PR is a patch for files/tomcat55.sh.in >How-To-Repeat: # service tomcat55 stop --> If tomcat_wait_max_for_pid times out, then the java process is still running >Fix: Patch attached with submission follows: --- tomcat55.sh.in.orig 2011-06-28 13:07:26.000000000 -0700 +++ tomcat55.sh.in 2011-06-28 13:11:22.000000000 -0700 @@ -132,31 +132,20 @@ } tomcat%%TOMCAT_VERSION%%_stop() { - rc_pid=$(check_pidfile $pidfile $procname) - - 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?" - fi + if [ ! -e "$pidfile" ]; then + echo "${name} not running? (check $pidfile)." return 1 fi echo "Stopping ${name}." ${java_command} stop tomcat_wait_max_for_pid ${tomcat%%TOMCAT_VERSION%%_stop_timeout} `cat $pidfile` - kill -KILL ${rc_pid} 2> /dev/null && echo "Killed." - echo -n > ${pidfile} + kill -KILL `cat $pidfile` 2> /dev/null && echo "Killed." + rm -f ${pidfile} } tomcat%%TOMCAT_VERSION%%_status() { - if [ ! -f $pidfile ]; then - pid_touch - fi - - if [ -z `cat $pidfile` ]; then + if [ ! -e "$pidfile" ]; then echo "${name} is not running." return 1 else >Release-Note: >Audit-Trail: >Unformatted: