Description of problem: No matter what CATALINA_PID is set to in /etc/sysconfig/${NAME}, /etc/init.d/tomcat assumes the pid file is at /var/run/${NAME}.pid Version-Release number of selected component (if applicable): 7.0.33-4 How reproducible: Set CATALINA_PID to something other name /var/run/${NAME}.pid in /etc/sysconfig/${NAME} Steps to Reproduce: 1. echo 'CATALINA_PID=/var/run/whatsmyname.pid' >> /etc/sysconfig/tomcat 2. service tomcat start Actual results: CATALINA_PID=/var/run/tomcat.pid Expected results: CATALINA_PID=/var/run/whatsmyname.pid Additional info: This ends up a problems because the Tomcat init script sets the ownership on CATALINA_PID to TOMCAT_USER:TOMCAT_GROUP so Tomcat can write to the file, but this will fail when CATALINA_PID is set to something other than /var/run/${NAME}.pid
The patch for this is below. diff -ur tomcat-7.0.33-4.el6.pid/etc/init.d/tomcat tomcat-7.0.33-4.el6/etc/init.d/tomcat --- tomcat-7.0.33-4.el6.pid/etc/init.d/tomcat 2014-12-03 10:12:51.689838620 -0500 +++ tomcat-7.0.33-4.el6/etc/init.d/tomcat 2014-12-03 10:10:49.812736936 -0500 @@ -69,6 +69,8 @@ # Define the tomcat log file TOMCAT_LOG="${TOMCAT_LOG:-${CATALINA_HOME}/logs/${NAME}-initd.log}" +# Define the tomcat pid file +CATALINA_PID="${CATALINA_PID:-/var/run/${NAME}.pid}" RETVAL="0" @@ -162,7 +164,6 @@ fi fi # fix permissions on the log and pid files - export CATALINA_PID="/var/run/${NAME}.pid" touch $CATALINA_PID 2>&1 || RETVAL="4" if [ "$RETVAL" -eq "0" -a "$?" -eq "0" ]; then chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID @@ -210,8 +211,8 @@ fi if [ "$RETVAL" -eq "0" ]; then count="0" - if [ -s "/var/run/${NAME}.pid" ]; then - read kpid < /var/run/${NAME}.pid + if [ -s "$CATALINA_PID" ]; then + read kpid < $CATALINA_PID until [ "$(ps --pid $kpid | grep -c $kpid)" -eq "0" ] || \ [ "$count" -gt "$SHUTDOWN_WAIT" ]; do if [ "$SHUTDOWN_VERBOSE" = "true" ]; then @@ -228,7 +229,7 @@ fi log_success_msg fi - rm -f /var/lock/subsys/${NAME} /var/run/${NAME}.pid + rm -f /var/lock/subsys/${NAME} $CATALINA_PID else log_failure_msg RETVAL="4" @@ -262,7 +263,7 @@ start ;; condrestart|try-restart) - if [ -s "/var/run/${NAME}.pid" ]; then + if [ -s "$CATALINA_PID" ]; then stop start fi @@ -271,14 +272,14 @@ RETVAL="3" ;; force-reload) - if [ -s "/var/run/${NAME}.pid" ]; then + if [ -s "$CATALINA_PID" ]; then stop start fi ;; status) - if [ -s "/var/run/${NAME}.pid" ]; then - read kpid < /var/run/${NAME}.pid + if [ -s "$CATALINA_PID" ]; then + read kpid < $CATALINA_PID if [ -d "/proc/${kpid}" ]; then log_success_msg "${NAME} (pid ${kpid}) is running..." RETVAL="0"
https://github.com/csutherl/fedora-tomcat/commit/017ab53 There was one missing /var/run/${NAME}.pid usage in the above patch, but other than that (which I added in the above commit) it looks good.
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions
https://pkgs.fedoraproject.org/cgit/rpms/tomcat.git/commit/?h=el6&id=bbe9e2e
tomcat-7.0.70-2.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3ff1f4485b
tomcat-7.0.70-2.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-3ff1f4485b
tomcat-7.0.70-2.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.