[one-users] startup script should create dir if not present

Robert Schweikert rschweikert at novell.com
Thu Jun 2 07:01:05 PDT 2011


Hi,

IMHO the "one" startup script should create the directory for the pid 
files if the directory is not present. Reason is that /var/run may be 
located on a tmpfs and thus it might go away with every boot. Expecting 
the sysadmin to create the directory every time or writing her/his own 
script appears to me not very user friendly.

Here is the patch I am applying in OBS to build the SUSE package.

--- share/scripts/one.orig
+++ share/scripts/one
@@ -17,6 +17,7 @@
 
#--------------------------------------------------------------------------- 
#

  if [ -z "$ONE_LOCATION" ]; then
+    ONE_PIDDIR=/var/run/one
      ONE_PID=/var/run/one/oned.pid
      ONE_SCHEDPID=/var/run/one/sched.pid
      ONE_CONF=/etc/one/oned.conf
@@ -28,6 +29,7 @@ if [ -z "$ONE_LOCATION" ]; then

      LOCK_FILE=/var/lock/one/one
  else
+    ONE_PIDDIR=$ONE_LOCATION/var
      ONE_PID=$ONE_LOCATION/var/oned.pid
      ONE_SCHEDPID=$ONE_LOCATION/var/sched.pid
      ONE_CONF=$ONE_LOCATION/etc/oned.conf
@@ -53,6 +55,10 @@ setup()
          exit 1
      fi

+    if [ ! -d $ONE_PIDDIR ]; then
+	mkdir $ONE_PIDDIR
+    fi
+
      if [ -f $LOCK_FILE ]; then
          if [ -f  $ONE_PID ]; then
              ONEPID=`cat $ONE_PID`

The directories required in /var/lock and /var/log are created by the 
package in %post. However, for general use of OpenNebula outside of a 
package install it might make sense to have the "one" startup script 
create these directories as well. Although, since neither /var/lock nor 
/var/log are expected on tmpfs, AFAIK, the creation is a one time setup 
task and thus may not be desired in the "one" startup script.


Robert
-- 
Robert Schweikert                           MAY THE SOURCE BE WITH YOU
SUSE-IBM Software Integration Center                   LINUX
Tech Lead
rschweikert at novell.com
rschweikert at ca.ibm.com
781-464-8147



More information about the Users mailing list