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.
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
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
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.