Bug 534200 - (RHQ-1019) don't default pid file directory to /var/run since only root can write there
don't default pid file directory to /var/run since only root can write there
Status: CLOSED NEXTRELEASE
Product: RHQ Project
Classification: Other
Component: Launch Scripts (Show other bugs)
unspecified
All All
medium Severity medium (vote)
: ---
: ---
Assigned To: John Mazzitelli
Corey Welton
http://jira.rhq-project.org/browse/RH...
: Improvement
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-23 12:58 EDT by John Mazzitelli
Modified: 2008-12-10 12:43 EST (History)
0 users

See Also:
Fixed In Version: 1.2
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Mazzitelli 2008-10-23 12:58:00 EDT
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:

Index: modules/enterprise/agent/src/etc/rhq-agent-wrapper.sh
===================================================================
--- 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
-   RHQ_AGENT_PIDFILE_DIR=/var/run
-fi
-mkdir -p $RHQ_AGENT_PIDFILE_DIR
-
 # The --daemon argument is required, but you can add additional arguments as appropriate
 export RHQ_AGENT_CMDLINE_OPTS=--daemon
 
@@ -61,6 +56,11 @@
       }
 fi
 
+if [ "x$RHQ_AGENT_PIDFILE_DIR" = "x" ]; then
+   RHQ_AGENT_PIDFILE_DIR=${RHQ_AGENT_HOME}/bin
+fi
+mkdir -p $RHQ_AGENT_PIDFILE_DIR
+
 RHQ_AGENT_START_SCRIPT=${RHQ_AGENT_START_SCRIPT_DIR}/rhq-agent.sh
 
 if [ ! -f $RHQ_AGENT_START_SCRIPT ]; then
Index: modules/enterprise/server/container/src/main/bin-resources/bin/rhq-server.sh
===================================================================
--- 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
-   RHQ_SERVER_PIDFILE_DIR=/var/run
+   RHQ_SERVER_PIDFILE_DIR=${RHQ_SERVER_HOME}/bin
 fi
 mkdir -p $RHQ_SERVER_PIDFILE_DIR
 
Comment 1 John Mazzitelli 2008-10-23 14:40:31 EDT
svn rev 1838
Comment 2 Corey Welton 2008-12-10 12:43:17 EST
QA Verified, .pid now gets written to $RHQ_AGENT_HOME/bin and $RHQ_SERVER_HOME/bin locations
Comment 3 Red Hat Bugzilla 2009-11-10 15:22:00 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-1019
This bug relates to RHQ-1003

Note You need to log in before you can comment on or make changes to this bug.