Bug 960255
| Summary: | Status Script does not return the proper PID. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Eric Rich <erich> |
| Component: | tomcat6 | Assignee: | David Knox <dknox> |
| Status: | CLOSED ERRATA | QA Contact: | tomcat-qe |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.6 | CC: | jclere, lkonno, mhasko |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-11-21 23:51:22 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
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 |
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 }