Red Hat Bugzilla – Bug 534200
don't default pid file directory to /var/run since only root can write there
Last modified: 2008-12-10 12:43:00 EST
The agent and server both do not need to run as root. Typically the user who installed the agent and server is the user running it (this is true at least in the testing/demoing situations). But the default for RHQ_AGENT_PIDFILE_DIR and RHQ_SERVER_PIDFILE_DIR is /var/run.
This means that unless you are root, you cannot use the launch scripts without doing something custom (like setting those env vars explicitly and point to some other directory the user has write perms to).
I recommend that we default to $RHQ_AGENT_HOME/bin and $RHQ_SERVER_HOME/bin since we have a better shot at working out of box (because we assume the person who installed will most likely be the person running the software too).
Here's the patch that I recommend we apply:
--- modules/enterprise/agent/src/etc/rhq-agent-wrapper.sh (revision 1834)
+++ modules/enterprise/agent/src/etc/rhq-agent-wrapper.sh (working copy)
@@ -22,7 +22,7 @@
# You may optionally set the RHQ_AGENT_PIDFILE_DIR environment variable if
# you want to write the pidfile to a specific location. This value must
# be a full path to a directory with write permissions so the pidfile can
-# be stored there. If not set, its default is /var/run.
+# be stored there. If not set, its default is the agent's bin directory.
# Here are some environment variables you can set to customize the launch
@@ -36,11 +36,6 @@
# export RHQ_AGENT_JAVA_OPTS=VM options
# export RHQ_AGENT_ADDITIONAL_JAVA_OPTS=additional VM options
-if [ "x$RHQ_AGENT_PIDFILE_DIR" = "x" ]; then
-mkdir -p $RHQ_AGENT_PIDFILE_DIR
# The --daemon argument is required, but you can add additional arguments as appropriate
@@ -61,6 +56,11 @@
+if [ "x$RHQ_AGENT_PIDFILE_DIR" = "x" ]; then
+mkdir -p $RHQ_AGENT_PIDFILE_DIR
if [ ! -f $RHQ_AGENT_START_SCRIPT ]; then
--- modules/enterprise/server/container/src/main/bin-resources/bin/rhq-server.sh (revision 1834)
+++ modules/enterprise/server/container/src/main/bin-resources/bin/rhq-server.sh (working copy)
@@ -54,7 +54,8 @@
# RHQ_SERVER_PIDFILE_DIR - a full path to a writable directory where this
# script can write its pidfile to.
-# If not defined, this defaults to "/var/run".
+# If not defined, this defaults to the server's
+# bin directory.
# If the embedded JRE is to be used but is not available, the fallback
# JRE to be used will be determined by the JAVA_HOME environment variable.
@@ -262,7 +263,7 @@
if [ -z "$RHQ_SERVER_PIDFILE_DIR" ]; then
mkdir -p $RHQ_SERVER_PIDFILE_DIR
svn rev 1838
QA Verified, .pid now gets written to $RHQ_AGENT_HOME/bin and $RHQ_SERVER_HOME/bin locations
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1019
This bug relates to RHQ-1003