xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-core/busybox/files/busybox-udhcpd (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2DAEMON=/usr/sbin/udhcpd
3NAME=udhcpd
4DESC="Busybox UDHCP Server"
5ARGS="/etc/udhcpd.conf"
6
7test -f $DAEMON || exit 1
8
9set -e
10
11case "$1" in
12    start)
13        echo -n "starting $DESC: $NAME... "
14	if [ ! -f /etc/udhcpd.conf ]; then
15		echo "error: /etc/udhcpd.conf is missing."
16		exit 1
17	fi
18	/sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
19	echo "done."
20	;;
21    stop)
22        echo -n "stopping $DESC: $NAME... "
23	/sbin/start-stop-daemon -K -n $NAME
24	echo "done."
25	;;
26    restart)
27        echo "restarting $DESC: $NAME... "
28 	$0 stop
29	$0 start
30	echo "done."
31	;;
32    reload)
33    	echo -n "reloading $DESC: $NAME... "
34    	killall -HUP $(basename ${DAEMON})
35	echo "done."
36	;;
37    *)
38	echo "Usage: $0 {start|stop|restart|reload}"
39	exit 1
40	;;
41esac
42
43exit 0
44