| Summary: | init script status command gives incorrect result | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora EPEL | Reporter: | Ken Geis <geis.ken> | ||||||
| Component: | tomcat | Assignee: | Coty Sutherland <csutherl> | ||||||
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||
| Severity: | high | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | el6 | CC: | alee, coolsvap, csutherl, geis.ken, ivan.afonichev, trick | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | --- | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Linux | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | tomcat-7.0.75-1.el6 | Doc Type: | If docs needed, set a value | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | Environment: | ||||||||
| Last Closed: | 2017-03-22 14:47:37 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: | |||||||
| Attachments: |
|
||||||||
I am able to work around this by changing the test to
pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} -f "${CATALINA_BASE}[ $]")"
Thanks for the report, Ken. I made a bad assumption that $NAME would always be available, but it isn't (as you said). I think $CATALINA_BASE will work fine (I tested it previously), so I'll try and switch over to that method soon. I tested this a bit more and it seems that you need to specify which property you're looking for instead of just "${CATALINA_BASE}[ $]", otherwise you'll get false positives when you have the same CATALINA_HOME as some other service.
I'm attaching a patch shortly, can you test to verify I didn't miss something?
Created attachment 1249138 [details]
patch proposal for testing
Here's what I think works best.
Created attachment 1249139 [details]
correct patch
That other patch was from the wrong version :(
This patch works for me. It would be more correct to escape the . in the pattern. tomcat-7.0.75-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-c3b112eb9e tomcat-7.0.75-1.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-2017-c3b112eb9e tomcat-7.0.75-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report. |
Description of problem: I am running a service with a different NAME than tomcat. When I ask for its status, it says that it's not running. Version-Release number of selected component (if applicable): 7.0.70-2.el6 How reproducible: I was able to reproduce it simply as below. Steps to Reproduce: 1. create additional Tomcat service by linking foo to tomcat in /etc/init.d 2. create a simple Catalina base in /tmp/bar 3. in /etc/sysconfig/foo set CATALINA_BASE=/tmp/bar CATALINA_TMPDIR=/tmp/bar/temp CATALINA_PID=/var/run/foo.pid 4. service foo start 5. service foo status Actual results: <NAME> (pid <pid>) is running... [ OK ] <NAME> lockfile exists but process is not running [FAILED] Expected results: <NAME> (pid <pid>) is running... [ OK ] Additional info: /etc/init.d/tomcat tries to get the PID by pid="$(/usr/bin/pgrep -d , -u ${TOMCAT_USER} -G ${TOMCAT_USER} -f "${NAME}[ $]")" This does not work here because ${NAME} does not appear anywhere in the command line. Perhaps it would if $CATALINA_BASE contained $NAME.