Commit | Line | Data |
---|---|---|
d1be43ee LM |
1 | #!/bin/sh |
2 | VER=1.0 | |
3 | # ============================================================================ | |
4 | # | |
5 | # Copyright (C) THALES. All rights reserved | |
6 | # Author: Thomas Perennou (Viveris Technologies) | |
7 | # Date : 03/12/2014 | |
8 | # ============================================================================ | |
9 | ||
10 | ### BEGIN INIT INFO | |
11 | # Provides: waitswithes | |
12 | # Required-Start: $network | |
13 | # Required-Stop: | |
14 | # Should-Start: | |
15 | # Default-Start: 2 3 4 5 | |
16 | # Default-Stop: 0 1 6 | |
17 | # Short-Description: Wait switches | |
18 | # Description: Wait for all switches are ready for running | |
19 | ### END INIT INFO | |
20 | ||
21 | ENABLE="yes" | |
22 | SCRIPT=/opt/trc6500/script/check_switches.sh | |
23 | TIMEOUT=360 | |
24 | ||
25 | PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
26 | [ -f /etc/default/waitswitches ] && . /etc/default/waitswitches | |
27 | [ -x $SCRIPT ] || exit 1 | |
28 | [ "$ENABLE" = "yes" ] || exit 0 | |
29 | ||
30 | . /lib/lsb/init-functions | |
31 | ||
32 | do_start () { | |
33 | log_action_msg "Wait all switches" | |
34 | $SCRIPT -t $TIMEOUT -w | |
35 | } | |
36 | ||
37 | case "$1" in | |
38 | -v) | |
39 | echo "$(basename $0), version $VER" | |
40 | ;; | |
41 | start) | |
42 | do_start | |
43 | ;; | |
44 | restart|reload|force-reload) | |
45 | echo "Error: argument '$1' not supported" >&2 | |
46 | exit 3 | |
47 | ;; | |
48 | stop) | |
49 | # No-op | |
50 | ;; | |
51 | *) | |
52 | echo "Usage: $0 start|stop" >&2 | |
53 | exit 3 | |
54 | ;; | |
55 | esac | |
56 | ||
57 | # vim:set tabstop=4 expandtab shiftwidth=4: |