updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / busybox-httpd / busybox-httpd-rc
blob745c508ff872606ff4914662e19994f7388c1dbf
1 #!/bin/bash
2 #universal daemon controller
3 # general config
4 . /etc/rc.conf
5 . /etc/rc.d/functions
7 daemonid="busybox-httpd" #arch-style daemon identification
8 binary="/usr/bin/busybox-httpd" #daemon binary
9 pidfile="/var/run/$daemonid.pid" #maybe you don't need to change this...
10 description="BusyBox HTTP Daemon" #daemon description...
12 PID=$(cat "$pidfile" 2>/dev/null);
14 case "$1" in
15 start)
16 stat_busy "Starting $description"
17 [ -z "$PID" ] && "$binary" "$pidfile" 2>&1
18 if [ $? -gt 0 ]; then
19 stat_fail
20 else
21 add_daemon "$daemonid"
22 stat_done
25 stop)
26 stat_busy "Stopping $description"
27 [ ! -z "$PID" ] && kill $PID &>/dev/null
28 if [ $? -gt 0 ]; then
29 rm -f "$pidfile"
30 stat_fail
31 else
32 rm_daemon "$daemonid"
33 rm -f "$pidfile"
34 stat_done
37 restart)
38 $0 stop
39 sleep 1
40 $0 start
43 echo "usage: $0 {start|stop|restart}"
44 esac