wok annotate busybox/stuff/udhcpd @ rev 882
Up: sakura (2.1.2)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jun 07 11:09:33 2008 +0200 (2008-06-07) |
parents | |
children | c88819f36315 |
rev | line source |
---|---|
pascal@620 | 1 #!/bin/sh |
pascal@620 | 2 # /etc/init.d/udhcpd: Start, stop and restart Udhcp deamon on SliTaz, at boot |
pascal@620 | 3 # time or with the command line. |
pascal@620 | 4 # |
pascal@620 | 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS |
pascal@620 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
pascal@620 | 7 # |
pascal@620 | 8 . /etc/init.d/rc.functions |
pascal@620 | 9 . /etc/daemons.conf |
pascal@620 | 10 |
pascal@620 | 11 NAME=Udhcpd |
pascal@620 | 12 DESC="udhcp deamon" |
pascal@620 | 13 DAEMON=/usr/sbin/udhcpd |
pascal@620 | 14 OPTIONS=$UDHCPD_OPTIONS |
pascal@620 | 15 PIDFILE=/var/run/udhcpd.pid |
pascal@620 | 16 |
pascal@620 | 17 case "$1" in |
pascal@620 | 18 start) |
pascal@620 | 19 if [ -f $PIDFILE ] ; then |
pascal@620 | 20 echo "$NAME already running." |
pascal@620 | 21 exit 1 |
pascal@620 | 22 fi |
pascal@620 | 23 echo -n "Starting $DESC: $NAME... " |
pascal@620 | 24 $DAEMON $OPTIONS |
pascal@620 | 25 status |
pascal@620 | 26 ;; |
pascal@620 | 27 stop) |
pascal@620 | 28 if [ ! -f $PIDFILE ] ; then |
pascal@620 | 29 echo "$NAME is not running." |
pascal@620 | 30 exit 1 |
pascal@620 | 31 fi |
pascal@620 | 32 echo -n "Stopping $DESC: $NAME... " |
pascal@620 | 33 kill `cat $PIDFILE` |
pascal@620 | 34 status |
pascal@620 | 35 ;; |
pascal@620 | 36 restart) |
pascal@620 | 37 if [ ! -f $PIDFILE ] ; then |
pascal@620 | 38 echo "$NAME is not running." |
pascal@620 | 39 exit 1 |
pascal@620 | 40 fi |
pascal@620 | 41 echo -n "Restarting $DESC: $NAME... " |
pascal@620 | 42 kill `cat $PIDFILE` |
pascal@620 | 43 sleep 2 |
pascal@620 | 44 $DAEMON $OPTIONS |
pascal@620 | 45 status |
pascal@620 | 46 ;; |
pascal@620 | 47 *) |
pascal@620 | 48 echo "" |
pascal@620 | 49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@620 | 50 echo "" |
pascal@620 | 51 exit 1 |
pascal@620 | 52 ;; |
pascal@620 | 53 esac |
pascal@620 | 54 |
pascal@620 | 55 exit 0 |