-
Notifications
You must be signed in to change notification settings - Fork 36
/
kplex.init
executable file
·57 lines (51 loc) · 1.46 KB
/
kplex.init
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
#!/bin/sh
### BEGIN INIT INFO
# Provides: nmeamultiplex
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start kplex NMEA 0183 multiplexer
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/usr/bin/kplex
KPLEXCONF=/etc/kplex.conf
PIDFILE=/var/run/kplex.pid
RUN_AS_USER=root
test -x $DAEMON || exit 5
test -r $KPLEXCONF || exit 5
test -d /var/run && test -w /var/run || exit 5
case $1 in
start)
log_daemon_msg "Starting kplex multiplexer" "kplex"
start-stop-daemon --start --quiet --oknodo --exec $DAEMON --startas $DAEMON --chuid $RUN_AS_USER -- -f $KPLEXCONF -p $PIDFILE -o mode=background
status=$?
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping kplex multiplexer" "kplex"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON --pidfile $PIDFILE
log_end_msg $?
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
exit 3
;;
status)
status_of_proc -p $PIDFILE $DAEMON "kplex NMEA 0183 multiplexer"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 2
;;
esac