-
Notifications
You must be signed in to change notification settings - Fork 1
/
bluedard
executable file
·68 lines (61 loc) · 1.24 KB
/
bluedard
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
#!/bin/bash
# source application-specific settings
# Setup these config files for custom configs
#[ -f /etc/conf.d/bluedard ] && . /etc/conf.d/bluedard
# general config
# This is for the rc.d contants/functions
. /etc/rc.conf
. /etc/rc.d/functions
getPID() {
echo `ps ax|grep BlueDarD.py|grep -v grep|awk '{ print $1 }'`
}
case "$1" in
start)
stat_busy "Starting BlueDarD"
if [ -z "$(getPID)" ]; then
python /usr/bin/BlueDarD.py > /var/log/bluedard.log&
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
sleep 1
if [ -z "$(getPID)" ]; then
stat_fail
exit 1
else
echo $(getPID) >/var/run/bluedard.pid
add_daemon bluedard
stat_done
fi
fi
else
stat_fail
exit 1
fi
;;
stop)
stat_busy "Stopping BlueDarD"
if [ ! -z "$(getPID)" ]; then
kill $(getPID) &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
rm -f /var/run/bluedard.pid &>/dev/null
rm_daemon bluedard
stat_done
fi
else
stat_fail
exit 1
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0