Bug 858138

Summary: rhq-agent-env.sh gives example of bad su command
Product: [Other] RHQ Project Reporter: James Livingston <jlivings>
Component: Launch ScriptsAssignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: low Docs Contact:
Priority: unspecified    
Version: 4.4CC: hrupp, joallen, loleary, tsegismo
Target Milestone: ---   
Target Release: RHQ 4.6   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 864239 (view as bug list) Environment:
Last Closed: 2013-09-03 10:42:13 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 864239    

Description James Livingston 2012-09-18 02:29:09 EDT
In rhq-agent-env.sh there is an example of setting RHQ_AGENT_START_COMMAND, which is useful when you use the wrapper script to run it as a service on RHEL. The example is gives is problematic causing it not to work correctly:
  RHQ_AGENT_START_COMMAND="su -m -l user -c '${RHQ_AGENT_HOME}/bin/rhq-agent.sh'"


The -l option overrides -m, and the result is that the environment is not propagated. When using the wrapper script as a SysV init script, the RHQ_AGENT_IN_BACKGROUND variable will be missing, so the pid file will be written into the wrong directory.

Removing the -l option fixes that, but I'm not 100% certain why it was there beyond it being common.
Comment 1 Thomas Segismont 2012-12-03 17:25:16 EST
The RHQ_AGENT_START_COMMAND variable example is like this in the script since its introduction on 14/12/2008.

Before that, one was only able to prefix the agent start command. And the given example was:
  RHQ_AGENT_RUN_PREFIX=su -m - ${RHQ_AGENT_RUN_AS} -c
Comment 2 Thomas Segismont 2012-12-10 04:30:34 EST
Removed -l option from RHQ_AGENT_START_COMMAND example.
Beware though that the user should not define env variables in the JBoss user shell startup files (no login).

master 1cdbda2
Comment 3 Heiko W. Rupp 2013-09-03 10:42:13 EDT
Bulk closing of issues in old RHQ releases that are in production for a while now.

Please open a new issue when running into an issue.