+++ This bug was initially created as a clone of RHQ Bug #858138 +++ 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 directly. Removing the -l option fixes that, but I'm not 100% certain why it was there beyond it being common.
commit a9b76bf3cb25a329c00a7084a6f5583105c6b456 Author: Thomas SEGISMONT <tsegismo> Date: Mon Dec 10 10:20:00 2012 +0100 Bug 864239 rhq-agent-env.sh gives example of bad su command (cherry-picked from 1cdbda2, bug 858138) -l overrides -m behavior in RHQ_AGENT_START_COMMAND example
Moving to ON_QA as new build available to test with: https://brewweb.devel.redhat.com/buildinfo?buildID=247371
verified in JON 3.1.2 ER5