upload tizen1.0 source
[external/busybox.git] / util-linux / debian / tree / udhcpd / etc / init.d / udhcpd
1 #! /bin/sh
2 #
3 # Written by Miquel van Smoorenburg <miquels@cistron.nl>.
4 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>
5 # and Axel Beckert <abe@deuxchevaux.org>.
6 #
7 ### BEGIN INIT INFO
8 # Provides:          udhcpd
9 # Required-Start:    $remote_fs $syslog
10 # Required-Stop:     $remote_fs $syslog
11 # Default-Start:     2 3 4 5
12 # Default-Stop:      0 1 6
13 # Short-Description: Start busybox udhcpd at boot time
14 ### END INIT INFO
15
16 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
17 DAEMON=/usr/sbin/udhcpd
18 NAME=udhcpd
19 DESC="very small Busybox based DHCP server"
20 DHCPD_OPTS="-S" # Additional options given to the server
21
22 test -x $DAEMON || exit 0
23
24 # Include defaults if available
25 if [ -f /etc/default/udhcpd ] ; then
26         . /etc/default/udhcpd
27 fi
28
29 if [ "$DHCPD_ENABLED" = "no" ]; then
30     echo $NAME: Disabled. Edit /etc/default/udhcpd to enable it.
31     exit 0;
32 fi
33
34 set -e
35
36 case "$1" in
37   start)
38         echo -n "Starting $DESC: "
39         start-stop-daemon --start --verbose --pidfile /var/run/$NAME.pid \
40                 --oknodo --exec $DAEMON -- $DHCPD_OPTS
41         echo "$NAME."
42         ;;
43   stop)
44         echo -n "Stopping $DESC: "
45         start-stop-daemon --stop --verbose --pidfile /var/run/$NAME.pid \
46                 --oknodo --exec $DAEMON
47         echo "$NAME."
48         ;;
49   restart|force-reload)
50         $0 stop
51         sleep 1
52         $0 start        
53         ;;
54   *)
55         N=/etc/init.d/$NAME
56         echo "Usage: $N {start|stop|restart|force-reload}" >&2
57         exit 1
58         ;;
59 esac
60
61 exit 0