]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Verify that radosgw started, return appropriate exit code
authorDavid Moreau Simard <dmsimard@iweb.com>
Tue, 5 Nov 2013 16:40:31 +0000 (11:40 -0500)
committerDavid Moreau Simard <dmsimard@iweb.com>
Tue, 5 Nov 2013 16:57:26 +0000 (11:57 -0500)
Changed "/etc/init.d/radosgw status" into a function that now
returns the appropriate exit code.
We now also verify that radosgw actually started properly.

Signed-off-by: David Moreau Simard <dmsimard@iweb.com>
src/init-radosgw
src/init-radosgw.sysv

index 85afc308406fc38d36b5f9a69c1cffc17db1620f..d3e2633e41c1ebbee1300ffdb8f0e5f201e039ad 100644 (file)
@@ -12,6 +12,17 @@ PATH=/sbin:/bin:/usr/bin
 
 . /lib/lsb/init-functions
 
+daemon_is_running() {
+    daemon=$1
+    if pidof $daemon >/dev/null; then
+        echo "$daemon is running."
+        exit 0
+    else
+        echo "$daemon is not running."
+        exit 1
+    fi
+}
+
 # prefix for radosgw instances in ceph.conf
 PREFIX='client.radosgw.'
 
@@ -58,6 +69,7 @@ case "$1" in
             echo "Starting $name..."
             start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
         done
+        daemon_is_running $RADOSGW
         ;;
     reload)
         echo "Reloading $name..."
@@ -71,12 +83,7 @@ case "$1" in
         start-stop-daemon --stop -x $RADOSGW --oknodo
         ;;
     status)
-        if pidof $RADOSGW >/dev/null; then
-            echo "$RADOSGW is running."
-        else
-            echo "$RADOSGW is not running."
-            exit 1
-        fi
+        daemon_is_running $RADOSGW
         ;;
     *)
         echo "Usage: $0 start|stop|restart|force-reload|reload|status" >&2
index 70b19950aaa41f9f79251df6958c40a294a99938..d3015b28425208d919ff5ea4fc2feec06206361a 100644 (file)
@@ -13,6 +13,17 @@ PATH=/sbin:/bin:/usr/bin
 #. /lib/lsb/init-functions
 . /etc/rc.d/init.d/functions
 
+daemon_is_running() {
+    daemon=$1
+    if pidof $daemon >/dev/null; then
+        echo "$daemon is running."
+        exit 0
+    else
+        echo "$daemon is not running."
+        exit 1
+    fi
+}
+
 # prefix for radosgw instances in ceph.conf
 PREFIX='client.radosgw.'
 
@@ -62,6 +73,7 @@ case "$1" in
             daemon --user="$user" "$RADOSGW -n $name"
             echo "Starting $name..."
         done
+        daemon_is_running $RADOSGW
         ;;
     reload)
         #start-stop-daemon --signal HUP -x $RADOSGW --oknodo
@@ -78,12 +90,7 @@ case "$1" in
         echo "Stopping radosgw instance(s)..."
         ;;
     status)
-        if pidof $RADOSGW >/dev/null; then
-            echo "$RADOSGW is running."
-        else
-            echo "$RADOSGW is not running."
-            exit 1
-        fi
+        daemon_is_running $RADOSGW
         ;;
     *)
         echo "Usage: $0 start|stop|restart|force-reload|reload|status" >&2