add wait switch service
authorLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 3 Dec 2014 17:25:45 +0000 (18:25 +0100)
committerLaurent Mazet <laurent.mazet@thalesgroup.com>
Wed, 3 Dec 2014 17:25:45 +0000 (18:25 +0100)
master/etc/init.d/waitswitches [new file with mode: 0755]

diff --git a/master/etc/init.d/waitswitches b/master/etc/init.d/waitswitches
new file mode 100755 (executable)
index 0000000..0a30d59
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+VER=1.0
+# ============================================================================
+#
+# Copyright (C) THALES. All rights reserved
+# Author: Thomas Perennou (Viveris Technologies)
+# Date : 03/12/2014
+# ============================================================================
+
+### BEGIN INIT INFO
+# Provides:          waitswithes
+# Required-Start:    $network
+# Required-Stop:
+# Should-Start:
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Wait switches
+# Description:       Wait for all switches are ready for running
+### END INIT INFO
+
+ENABLE="yes"
+SCRIPT=/opt/trc6500/script/check_switches.sh
+TIMEOUT=360
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+[ -f /etc/default/waitswitches ] && . /etc/default/waitswitches
+[ -x $SCRIPT ] || exit 1
+[ "$ENABLE" = "yes" ] || exit 0
+
+. /lib/lsb/init-functions
+
+do_start () {
+    log_action_msg "Wait all switches"
+    $SCRIPT -t $TIMEOUT -w
+}
+
+case "$1" in
+    -v)
+        echo "$(basename $0), version $VER"
+       ;;
+    start)
+        do_start
+        ;;
+    restart|reload|force-reload)
+        echo "Error: argument '$1' not supported" >&2
+        exit 3
+        ;;
+    stop)
+        # No-op
+        ;;
+    *)
+        echo "Usage: $0 start|stop" >&2
+        exit 3
+        ;;
+esac
+
+# vim:set tabstop=4 expandtab shiftwidth=4: