Bug 535784 (RHQ-2444)
Summary: | rhq-agent-wrapper.sh needs to be modified to work with SYSV init systems and chkconfig | ||
---|---|---|---|
Product: | [Other] RHQ Project | Reporter: | Mark Burchard <mburchar> |
Component: | Launch Scripts | Assignee: | John Mazzitelli <mazz> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 1.2 | CC: | dsteigne, mazz, mdimaio, tao |
Target Milestone: | --- | Keywords: | SubBug |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://jira.rhq-project.org/browse/RHQ-2444 | ||
Whiteboard: | |||
Fixed In Version: | 2.4 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: |
Reproduced on RHEL 5.3 and 5.4
|
|
Last Closed: | 2010-08-12 16:50:49 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 565628 |
Description
Mark Burchard
2009-09-30 19:06:00 UTC
Correction: line 104 RHQ-2461 reported the same thing, but says you can use -f option to correct the problem. Does Solaris support the -f option? No the Solaris version of readlink does not appear to support any options at all. However, in the case of Solaris 10, we should be providing an SMF init script[1], which obsoletes the need for readlink. [1]http://jira.rhq-project.org/browse/RHQ-2449 This bug was previously known as http://jira.rhq-project.org/browse/RHQ-2444 This bug is duplicated by RHQ-2461 Temporarily adding the keyword "SubBug" so we can be sure we have accounted for all the bugs. keyword: new = Tracking + FutureFeature + SubBug making sure we're not missing any bugs in rhq_triage we should test which works : -f or -e (or both?) we'll need to write this in such a way that it won't fail on solaris, since apparently neither switch is valid on solaris readlink -e works on solaris 9 at least: # uname -sr SunOS 5.9 # ls -l /bin lrwxrwxrwx 1 root root 9 Mar 24 2009 /bin -> ./usr/bin # readlink -f /bin /usr/bin I think this should be an easy fix, assuming readlink's -f option is cross-platform across all unix flavors The -e option is also available on solaris, which is probably the one we'd want to use: # uname -sr SunOS 5.9 # ls -l /bin lrwxrwxrwx 1 root root 9 Mar 24 2009 /bin -> ./usr/bin # readlink -e /bin /usr/bin the basic change will be made to rhq-agent.sh, rhq-agent-wrapper.sh and rhq-server.sh... it goes something like this: if [ "x${_LINUX}${_SOLARIS}${_CYGWIN}" != "x" ]; then # only certain platforms support the -e argument for readlink _READLINK_ARG="-e" fi _DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null || echo "$0"` Note that we'll know what platform we are on via this switch: case "`uname`" in CYGWIN*) _CYGWIN=true ;; Linux*) _LINUX=true ;; Darwin*) _DARWIN=true ;; SunOS*) _SOLARIS=true ;; AIX*) _AIX=true ;; esac MacOS doesn't support the -e flag. Unknown if AIX does, so I leave that alone for now. The main issue is on Fedora/RHEL anyway. We can add ${_AIX} to that if-stmt if we know AIX's version of readlink supports -e release-3.0.0 branch commit: 58c0104617caf09db42c7802e55d6df3fb420f81 To test: 1a) install an agent (I'll assume it is at /tmp/rhq-agent) 1b) install a server (I'll assume it is at /tmp/rhq-server) 2) Create two test directories: /tmp/test and a /tmp/test/subdir 3) Create a symlink to the agent and server scripts: ln -s /tmp/rhq-agent/bin/rhq-agent.sh /tmp/test/link.sh ln -s /tmp/rhq-agent/bin/rhq-agent-wrapper.sh /tmp/test/link-wrapper.sh ln -s /tmp/rhq-server/bin/rhq-server.sh /tmp/test/server-link.sh 4) Now create links to the links in that test subdir: ln -s /tmp/test/link.sh /tmp/test/subdir/another-link.sh ln -s /tmp/test/link-wrapper.sh /tmp/test/subdir/another-link-wrapper.sh ln -s /tmp/test/server-link.sh /tmp/test/subdir/another-server-link.sh 5) Turn on agent and server debug env vars so you can see the scripts' log messages on console: export RHQ_AGENT_DEBUG=true export RHQ_SERVER_DEBUG=true 6) Now run the links to the links (you don't need to run both agent and server together, we are just confirming the scripts themselves work and can determine the home directories OK - if they start the server and the agent fine its good - look at the debug logs on the console to confirm that RHQ_AGENT_HOME and RHQ_SERVER_HOME is set properly): /tmp/test/subdir/another-link.sh /tmp/test/subdir/another-link-wrapper.sh start /tmp/test/subdir/another-server-link.sh *** Bug 615322 has been marked as a duplicate of this bug. *** I tested this on Fedora11. I also confirmed this readlink argument fix works on Solaris 9. This fix is also applicable on Windows/Cygwin, though I didn't test that. This fix is not applicable on AIX or MacOS (AIX because I didnt know if readlink has -e on that platform, and MacOS because it doesn't look it -e is supported there). Therefore, this problem will probably still exist on AIX or MacOS - in those cases, just don't have symlink-to-symlink-to-script. This problem is showing up on RHEL/Fedora because of the way chkconfig creates symlink-to-symlink in rc3.d->init.d Mass-closure of verified bugs against JON. |