-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathservice.initd.sh
executable file
·53 lines (46 loc) · 1 KB
/
service.initd.sh
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: xtom-network-switch
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the xtom network switch
# Description: starts xtom network switch using start-stop-daemon
### END INIT INFO
PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
NAME=xtom-network-switch
PID_FILE="/var/run/$NAME.pid"
DAEMON="/opt/xtom-network-switch/network-switch"
WORK_DIR="$(dirname "$DAEMON")"
start() {
echo "Starting daemon: $NAME"
start-stop-daemon \
--start --quiet --background \
--pidfile "$PID_FILE" --make-pidfile \
--exec "$DAEMON" \
--chdir "$WORK_DIR"
}
stop() {
echo "Stopping daemon: $NAME"
start-stop-daemon \
--stop --quiet --oknodo --retry 30 \
--pidfile "$PID_FILE"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: $1 {start|stop|restart}"
exit 1
;;
esac
exit 0