From bbe9e2eb9c49750763f44aad94c0ba0c08091ebc Mon Sep 17 00:00:00 2001 From: Coty Sutherland Date: Aug 05 2016 14:06:53 +0000 Subject: Resolves: rhbz#1104708 Tomcat init script does not respect setting of CATALINA_PID in /etc/sysconfig/tomcat --- diff --git a/tomcat-7.0.init b/tomcat-7.0.init index a3fd004..bf0b5fc 100644 --- a/tomcat-7.0.init +++ b/tomcat-7.0.init @@ -69,6 +69,8 @@ TOMCAT_USER="${TOMCAT_USER:-tomcat}" # 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" @@ -149,8 +151,8 @@ function start() { return fi if [ -f "/var/lock/subsys/${NAME}" ]; then - if [ -s "/var/run/${NAME}.pid" ]; then - read kpid < /var/run/${NAME}.pid + if [ -s "$CATALINA_PID" ]; then + read kpid < $CATALINA_PID # if checkpid $kpid 2>&1; then if [ -d "/proc/${kpid}" ]; then log_success_msg @@ -162,7 +164,6 @@ function start() { 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 @@ function stop() { 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 @@ function stop() { 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 @@ case "$1" in start ;; condrestart|try-restart) - if [ -s "/var/run/${NAME}.pid" ]; then + if [ -s "$CATALINA_PID" ]; then stop start fi @@ -271,14 +272,14 @@ case "$1" in 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" diff --git a/tomcat.spec b/tomcat.spec index 62ef199..a55bd56 100644 --- a/tomcat.spec +++ b/tomcat.spec @@ -642,6 +642,7 @@ fi - Resolves: rhbz#1327327 rpm -V tomcat fails on /var/log/tomcat/catalina.out - Resolves: rhbz#1314177 Tomcat init script reports wrong status when one instance of several is stopped - Resolves: rhbz#1312280 Unable to overwrite the TOMCAT_SCRIPT variable +- Resolves: rhbz#1104708 Tomcat init script does not respect setting of CATALINA_PID in /etc/sysconfig/tomcat * Fri Nov 13 2015 Coty Sutherland 0:7.0.65-1 - Updated to 7.0.65