From d1be43ee76b0f50277ba1d3a76f305eb54e0449c Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Wed, 3 Dec 2014 18:25:45 +0100 Subject: [PATCH] add wait switch service --- master/etc/init.d/waitswitches | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 master/etc/init.d/waitswitches diff --git a/master/etc/init.d/waitswitches b/master/etc/init.d/waitswitches new file mode 100755 index 0000000..0a30d59 --- /dev/null +++ b/master/etc/init.d/waitswitches @@ -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: -- 2.30.2