ports/158410: [PATCH] www/tomcat55: improve pidfile handling in rc script
Phil Phillips
pphillips at experts-exchange.com
Tue Jun 28 20:30:10 UTC 2011
>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 at 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:
More information about the freebsd-ports-bugs
mailing list