forked from ursereg/ntripserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntripserver-init.sh
49 lines (45 loc) · 1.24 KB
/
ntripserver-init.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
#!/bin/sh
### BEGIN INIT INFO
# Provides: ntripserver
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage NTRIP server
### END INIT INFO
set -e
daemon="/usr/bin/ntripserver.sh"
process_kill="ntripserver"
pidfile="/var/run/ntripserver.pid"
daemon_opts=""
[ -x "${daemon}" ] || exit 0
case "${1}" in
start)
echo -n "Starting ntripserver: "
if [ -s "${pidfile}" ]; then
echo "already running, restarting"
start-stop-daemon -K -q -p "${pidfile}"
fi
start-stop-daemon -S -b -m -p "${pidfile}" -x "${daemon}" -- ${daemon_opts}
echo "done"
;;
stop)
echo -n "Stopping ntripserver: "
start-stop-daemon -K -q -p "${pidfile}"
killall "${process_kill}"
rm "${pidfile}"
echo "done"
;;
restart)
echo -n "Restarting ntripserver: "
start-stop-daemon -K -q -p "${pidfile}"
killall "${process_kill}"
rm "${pidfile}"
start-stop-daemon -S -b -m -p "${pidfile}" -x "${daemon}" -- ${daemon_opts}
echo "done"
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac