Red Hat Bugzilla – Bug 960255
Status Script does not return the proper PID.
Last modified: 2015-11-01 19:18:05 EST
Description of problem: Tomcat should return log_success_msg "${NAME} (pid ${kpid}) is running..." and not: log_success_msg "${NAME} (pid $pid) is running..." When Running a status under normal conditions. Because of the checkpidfile function the status function never runs the first if statement. (Functions Below) function checkpidfile() { if [ -f "${CATALINA_PID}" ]; then read kpid < ${CATALINA_PID} if [ -d "/proc/${kpid}" ]; then # The pid file exists and the process is running RETVAL="0" else # The pid file exists but the process is not running RETVAL="1" return fi fi # pid file does not exist and program is not running RETVAL="3" } function status() { checkpidfile if [ "$RETVAL" -eq "0" ]; then log_success_msg "${NAME} (pid ${kpid}) is running..." elif [ "$RETVAL" -eq "1" ]; then log_failure_msg "PID file exists, but process is not running" else checklockfile if [ "$RETVAL" -eq "2" ]; then log_failure_msg "${NAME} lockfile exists but process is not running" else pid="$(/usr/bin/pgrep -u ${TOMCAT_USER} -f ${NAME})" if [ -z "$pid" ]; then log_success_msg "${NAME} is stopped" RETVAL="3" else log_success_msg "${NAME} (pid $pid) is running..." RETVAL="0" fi fi fi } The following should be the fix to this issue: --- tomcat6.orig 2013-05-01 14:57:59.231736488 -0400 +++ /etc/init.d/tomcat6 2013-05-01 15:04:06.463736580 -0400 @@ -231,14 +231,17 @@ function checkpidfile() if [ -d "/proc/${kpid}" ]; then # The pid file exists and the process is running RETVAL="0" + return else # The pid file exists but the process is not running RETVAL="1" return fi - fi + else # pid file does not exist and program is not running - RETVAL="3" + RETVAL="3" + return + fi }
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2013-1721.html