Update man page of gnt-cluster regarding file-storage-dir
[ganeti-local] / doc / examples / ganeti.initd.in
index cd137bd..f16d35b 100644 (file)
@@ -1,6 +1,8 @@
 #!/bin/sh
-# ganeti node daemon starter script
-# based on skeleton from Debian GNU/Linux
+# ganeti daemons init script
+#
+# chkconfig: 2345 99 01
+# description: Ganeti Cluster Manager
 ### BEGIN INIT INFO
 # Provides:          ganeti
 # Required-Start:    $syslog $remote_fs
@@ -20,7 +22,14 @@ SCRIPTNAME="@SYSCONFDIR@/init.d/ganeti"
 
 test -f "$DAEMON_UTIL" || exit 0
 
-. /lib/lsb/init-functions
+if [ -r /lib/lsb/init-functions ]; then
+  . /lib/lsb/init-functions
+elif [ -r /etc/rc.d/init.d/functions ]; then
+  . /etc/rc.d/init.d/functions
+else
+  echo "Unable to find init functions"
+  exit 1
+fi
 
 check_exitcode() {
     RC=$1
@@ -75,6 +84,30 @@ stop_all() {
     done
 }
 
+status_all() {
+    local daemons="$1" status ret
+
+    if [ -z "$daemons" ]; then
+      daemons=$($DAEMON_UTIL list-start-daemons)
+    fi
+
+    status=0
+
+    for i in $daemons; do
+      if status_of_proc $($DAEMON_UTIL daemon-executable $i) $i; then
+          ret=0
+      else
+          ret=$?
+          # Use exit code from first failed call
+          if [ "$status" -eq 0 ]; then
+              status=$ret
+          fi
+      fi
+    done
+
+    exit $status
+}
+
 if [ -n "$2" ] && ! errmsg=$($DAEMON_UTIL is-daemon-name "$2" 2>&1); then
     log_failure_msg "$errmsg"
     exit 1
@@ -94,6 +127,9 @@ case "$1" in
         stop_all "$2"
         start_all "$2"
         ;;
+    status)
+        status_all "$2"
+        ;;
     *)
         log_success_msg "Usage: $SCRIPTNAME {start|stop|force-reload|restart}"
         exit 1