RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 960255 - Status Script does not return the proper PID.
Summary: Status Script does not return the proper PID.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tomcat6
Version: 6.6
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: David Knox
QA Contact: tomcat-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-06 19:33 UTC by Eric Rich
Modified: 2018-12-03 18:48 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-21 23:51:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1721 0 normal SHIPPED_LIVE tomcat6 bug fix update 2013-11-20 21:51:34 UTC

Description Eric Rich 2013-05-06 19:33:56 UTC
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
 }

Comment 5 errata-xmlrpc 2013-11-21 23:51:22 UTC
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


Note You need to log in before you can comment on or make changes to this bug.