Red Hat Bugzilla – Bug 464145
Getting the status of a tomcat5 service does not work with a different user than tomcat
Last modified: 2015-11-01 19:15:20 EST
Description of problem:
Calling "/etc/init.d/tomcat5 status" does not work if the user running a second tomcat instance has a name different to "tomcat".
Version-Release number of selected component (if applicable):
Server version: Apache Tomcat/5.5.23
Server built: Aug 22 2008 12:27:59
Server number: 184.108.40.206
Steps to Reproduce:
1. Create a second tomcat5 instance with a own start/stop script, e.g. /etc/init.d/tomcat5app
2. Set TOMCAT_USER for the second instant to a different user than "tomcat"
2. start tomcat5app
3. get its state with "/etc/init.d/tomcat5app status"
/etc/init.d/tomcat5app running (14464) but no PID file exists
/etc/init.d/tomcat5app is already running (14464)
The problem is in the script /etc/init.d/tomcat5 in function status() in the line
pid="$(pgrep -u tomcat java)"
which should be something like this
pid="$(pgrep -u $TOMCAT_USER java)"
Including this in LSB compliance work on init scripts
Works in tomcat5-5.5.23-0jpp.37.el5.