forked from mikepurvis/sixad
-
Notifications
You must be signed in to change notification settings - Fork 2
/
sixad.init
60 lines (55 loc) · 1.12 KB
/
sixad.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
58
59
60
#!/bin/bash
### BEGIN INIT INFO
# Provides: sixad
# Required-Start: $local_fs $syslog $remote_fs bluetooth
# Required-Stop: $local_fs $syslog $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start sixad
### END INIT INFO
#
# Author: falkTX <[email protected]>
#
# set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/bin/sixad
sixad_already_running_check () {
ps -e | grep sixad-bin > /dev/null
}
. /lib/lsb/init-functions
case "$1" in
start)
if (sixad_already_running_check "$1"); then
log_warning_msg "sixad is already running"
else
{
log_daemon_msg "Starting sixad"
$DAEMON --start &>>/var/log/sixad &
log_end_msg 0
}
fi
;;
stop)
if (sixad_already_running_check "$1"); then
{
log_daemon_msg "Stopping sixad"
$DAEMON --stop || true
log_end_msg 0
}
else
log_warning_msg "sixad is not running"
fi
;;
restart)
$0 stop
$0 start
;;
status)
status_of_proc "sixad-bin" "sixad" && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/sixad {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0