updated on Tue Jan 24 12:00:22 UTC 2012
[aur-mirror.git] / wifizoo / wifizoo.initscript
blobdd5a303317ce5af103918b8bdb9241350df69df4
1 #!/bin/bash
3 WIFIZOO_ARGS=
4 [ -f /etc/conf.d/wifizoo ] && . /etc/conf.d/wifizoo
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 PID=`ps -eo pid,cmd | grep wifizoo.py | grep -v grep | awk {'print $1;'}`
10 case "$1" in
11 start)
12 stat_busy "Starting Wifizoo"
13 if [ -z "${PID}" ]; then
14 cd /opt/wifizoo
15 python2 wifizoo.py ${WIFIZOO_ARGS} &> /dev/null &
17 if [ ! -z "$PID" -o $? -gt 0 ]; then
18 stat_fail
19 else
20 add_daemon wifizoo
21 stat_done
24 stop)
25 stat_busy "Stopping Wifizoo"
26 [ ! -z "${PID}" ] && kill ${PID} &> /dev/null
27 if [ $? -gt 0 ]; then
28 stat_fail
29 else
30 rm_daemon wifizoo
31 stat_done
34 restart)
35 $0 stop
36 sleep 1
37 $0 start
40 echo "usage: $0 {start|stop|restart}"
42 esac
43 exit 0