wok annotate busybox/stuff/udhcpd @ rev 5233
busybox: tipo in /etc/init.d/udhcpd
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 08 17:17:44 2010 +0200 (2010-04-08) |
parents | c88819f36315 |
children |
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@5233 | 19 if active_pidfile $PIDFILE udhcpd ; 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@5233 | 26 pidof udhcpd > $PIDFILE |
pascal@620 | 27 ;; |
pascal@620 | 28 stop) |
pascal@5233 | 29 if ! active_pidfile $PIDFILE udhcpd ; then |
pascal@620 | 30 echo "$NAME is not running." |
pascal@620 | 31 exit 1 |
pascal@620 | 32 fi |
pascal@620 | 33 echo -n "Stopping $DESC: $NAME... " |
pascal@620 | 34 kill `cat $PIDFILE` |
pascal@620 | 35 status |
pascal@620 | 36 ;; |
pascal@620 | 37 restart) |
pascal@5233 | 38 if ! active_pidfile $PIDFILE udhcpd ; then |
pascal@620 | 39 echo "$NAME is not running." |
pascal@620 | 40 exit 1 |
pascal@620 | 41 fi |
pascal@620 | 42 echo -n "Restarting $DESC: $NAME... " |
pascal@620 | 43 kill `cat $PIDFILE` |
pascal@620 | 44 sleep 2 |
pascal@620 | 45 $DAEMON $OPTIONS |
pascal@620 | 46 status |
pascal@5233 | 47 pidof udhcpd > $PIDFILE |
pascal@620 | 48 ;; |
pascal@620 | 49 *) |
pascal@620 | 50 echo "" |
pascal@620 | 51 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" |
pascal@620 | 52 echo "" |
pascal@620 | 53 exit 1 |
pascal@620 | 54 ;; |
pascal@620 | 55 esac |
pascal@620 | 56 |
pascal@620 | 57 exit 0 |