blob: 53e24f3406394844fabdd5625a60d101c350fec6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#! /bin/sh
#
# Copyright 2014-present Facebook. All Rights Reserved.
#
# This program file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program in a file named COPYING; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301 USA
#
### BEGIN INIT INFO
# Provides: usbcons
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Creates a virtual USB serial device and starts a console
# on it.
#
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME="FC Switcher"
DESC="FC Failover Daemon"
# source function library
. /etc/init.d/functions
. /usr/local/fbpackages/utils/ast-functions
STOPPER=
ACTION="$1"
case "$ACTION" in
start)
if [ "$(wedge_board_type)" = "LC" ]; then
# Ability to prevent this from starting by editing cmdline in u-boot.
# Keeping this here until I get gadget switching working properly. (t4906522)
/usr/local/bin/watch-fc.sh > /dev/null 2>&1 &
echo "$NAME."
else
echo 'skipping watch-fc.sh: only necessary on six-pack line cards.'
fi
;;
stop)
echo -n "Stopping $DESC: "
killall watch-fc.sh
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
killall watch-fc.sh
if [ "$(wedge_board_type)" = "LC" ]; then
sleep 1
/usr/local/bin/watch-fc.sh > /dev/null 2>&1 &
echo "$NAME."
else
echo 'skipping watch-fc.sh: only necessary on six-pack line cards.'
fi
;;
status)
status watch-fc.sh
exit $?
;;
*)
N=${0##*/}
N=${N#[SK]??}
echo "Usage: $N {start|stop|status|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|