[deltacloud-core/f16] Fixed init script

Michal Fojtik mfojtik at fedoraproject.org
Fri Nov 11 16:03:23 UTC 2011


commit 22828e775a33cb46b24245bddcc77172ff97f458
Author: Michal Fojtik <mi at mifo.sk>
Date:   Fri Nov 11 17:03:10 2011 +0100

    Fixed init script

 .gitignore           |    1 +
 deltacloud-core.init |   33 ++++++++++++++++++++-------------
 deltacloud-core.spec |    7 ++++++-
 sources              |    1 +
 4 files changed, 28 insertions(+), 14 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3093712..3dd9054 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 /0001-Vsphere-Removed-unnecessary-validation-in-create_ins.patch
 /0003-Openstack-driver.patch
 /0004-Fixed-validation-error.patch
+/deltacloud-core.init
diff --git a/deltacloud-core.init b/deltacloud-core.init
index 7422c59..916cb7b 100644
--- a/deltacloud-core.init
+++ b/deltacloud-core.init
@@ -7,13 +7,13 @@
 
 ### BEGIN INIT INFO
 # Provides: deltacloud-core
-# Required-Start: 
-# Required-Stop: 
-# Default-Start: 3 5 
-# Default-Stop: 0 1 2 6 
+# Required-Start:
+# Required-Stop:
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
 # Short-Description: Deltacloud Core API deamon
 # Description: Deltacloud Core API provides access to different cloud providers \
-#   using single REST API 
+#   using single REST API
 ### END INIT INFO
 
 . /etc/rc.d/init.d/functions
@@ -33,6 +33,7 @@ HOST="${HOST:-localhost}"
 DELTACLOUD_USER="${DELTACLOUD_USER:-nobody}"
 LOGFILE="${LOGFILE:-/var/log/$prog/$DRIVER.log}"
 LOCKFILE="${LOCKFILE:-/var/lock/subsys/$prog}"
+PIDFILE="${PIDFILE:-/var/run/deltacloud-core-$DRIVER.pid}"
 
 [ -r $LOGFILE ] && chown nobody $LOGFILE
 [ -r $LOCKFILE ] && chown nobody $LOCKFILE
@@ -40,8 +41,8 @@ LOCKFILE="${LOCKFILE:-/var/lock/subsys/$prog}"
 start() {
     [ -x $exec ] || exit 5
 
-    echo -n $"Starting $prog: "
-    daemon --user "$DELTACLOUD_USER" "$exec -i $DRIVER -e $API_ENV --port $PORT -r $HOST >> $LOGFILE 2>&1 &"
+    echo -n $"Starting $prog-$DRIVER: "
+    daemon "$exec -i $DRIVER -e $API_ENV --user $DELTACLOUD_USER --daemon --pid $PIDFILE --port $PORT --host $HOST"
     retval=$?
 
     if [ $retval -eq 0 ] && touch $LOCKFILE ; then
@@ -56,16 +57,22 @@ start() {
 
 stop() {
     echo -n $"Shutting down $prog: "
-    killproc deltacloudd
-    retval=$?
-    if [ $retval -eq 0 ] && rm -f $LOCKFILE ; then
-      echo_success
-      echo
+    if [ -f $PIDFILE ]; then
+      kill -3 `cat $PIDFILE`
+      retval=$?
+      if [ $retval -eq 0 ] && rm -f $LOCKFILE $PIDFILE; then
+        echo_success
+        echo
+      else
+        echo_failure
+        echo
+      fi
+      return $retval
     else
       echo_failure
       echo
+      return 1
     fi
-    return $retval
 }
 
 case "$1" in
diff --git a/deltacloud-core.spec b/deltacloud-core.spec
index bf6a875..58e2427 100644
--- a/deltacloud-core.spec
+++ b/deltacloud-core.spec
@@ -3,7 +3,7 @@
 Summary: Deltacloud REST API
 Name: deltacloud-core
 Version: 0.4.1
-Release: 5%{?dist}
+Release: 6%{?dist}
 Group: Development/Languages
 License: ASL 2.0 and MIT
 URL: http://incubator.apache.org/deltacloud
@@ -16,6 +16,7 @@ Patch2: 0001-Backported-r1181859-patches.patch
 Patch3: 0001-Vsphere-Removed-unnecessary-validation-in-create_ins.patch
 Patch4: 0003-Openstack-driver.patch
 Patch5: 0004-Fixed-validation-error.patch
+Patch6: 0005-Fixes-for-launcher.patch
 Requires: rubygems
 Requires: ruby(abi) = 1.8
 Requires: rubygem(haml)
@@ -219,6 +220,7 @@ pushd %{_builddir}/%{name}-%{version}
 %patch3 -p2
 %patch4 -p2
 %patch5 -p2
+%patch6 -p2
 popd
 
 %build
@@ -351,6 +353,9 @@ fi
 %{app_root}/config/drivers/google.yaml
 
 %changelog
+* Fri Nov 11 2011 Michal Fojtik <mfojtik at redhat.com> - 0.4.1-6
+- Fixed launcher and init script
+
 * Tue Nov 08 2011 Michal Fojtik <mfojtik at redhat.com> - 0.4.1-5
 - Backported validation fix for Rabbit BZ:750920
 
diff --git a/sources b/sources
index 6814c07..9402779 100644
--- a/sources
+++ b/sources
@@ -4,3 +4,4 @@ c29d9bd8b82d4c8f1c5ac7c69b3e9b22  0001-Backported-r1181859-patches.patch
 360b8ee6e41b4357fe1b2dfa72efa1c0  0001-Vsphere-Removed-unnecessary-validation-in-create_ins.patch
 2f97b62591116a380b319f5beb80f9d9  0003-Openstack-driver.patch
 0b8351b632963e0818f74cfdaad02e20  0004-Fixed-validation-error.patch
+0ce45b479ad4ccf4eb4d2f71a742488d  deltacloud-core.init


More information about the scm-commits mailing list