csync-git
[mirrors/ArchLinux-Packages.git] / busybox-httpd / busybox-httpd-rc
CommitLineData
209feeb0
H
1#!/bin/bash
2#universal daemon controller
3# general config
4. /etc/rc.conf
5. /etc/rc.d/functions
6
7daemonid="busybox-httpd" #arch-style daemon identification
8binary="/usr/bin/busybox-httpd" #daemon binary
9pidfile="/var/run/$daemonid.pid" #maybe you don't need to change this...
10description="BusyBox HTTP Daemon" #daemon description...
11
12PID=$(cat "$pidfile" 2>/dev/null);
13
14case "$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
23 fi
24 ;;
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
35 fi
36 ;;
37 restart)
38 $0 stop
39 sleep 1
40 $0 start
41 ;;
42 *)
43 echo "usage: $0 {start|stop|restart}"
44esac
This page took 0.145112 seconds and 4 git commands to generate.