updated on Sat Jan 14 12:12:45 UTC 2012
[aur-mirror.git] / phare / phare.rc
blobfb150c0b8716c856ac07aebd2e1c97085e9f7520
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
6 case "$1" in
7 start)
8 stat_busy "Starting python HTTP server"
9 if $(ck_daemon phare); then
10 cd /srv/phare
11 nohup /usr/bin/python -m http.server 8080 &>> /var/log/phare.log &
13 if [ $? -gt 0 ]; then
14 stat_fail
15 else
16 add_daemon phare
17 stat_done
20 stop)
21 stat_busy "Stopping python HTTP server"
22 ck_daemon phare || ps ax | awk '/python.*http\.server 8080/ {print $1}' | xargs kill
23 rm_daemon phare
24 stat_done
26 restart)
27 $0 stop
28 sleep 1
29 $0 start
31 status)
32 stat_busy 'Checking python HTTP server status'
33 ck_status phare
36 echo "usage: $0 {start|stop|restart|status}"
37 esac
38 exit 0