wok annotate dhcp/stuff/dhcpd @ rev 5234

dhcp: add init script
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Apr 08 17:22:33 2010 +0200 (2010-04-08)
parents
children 7f188676b59c
rev   line source
pascal@5234 1 #!/bin/sh
pascal@5234 2 # /etc/init.d/dhcpd: Start, stop and restart Dhcp deamon on SliTaz, at boot
pascal@5234 3 # time or with the command line.
pascal@5234 4 #
pascal@5234 5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
pascal@5234 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
pascal@5234 7 #
pascal@5234 8 . /etc/init.d/rc.functions
pascal@5234 9 . /etc/daemons.conf
pascal@5234 10
pascal@5234 11 NAME=Dhcpd
pascal@5234 12 DESC="dhcp deamon"
pascal@5234 13 DAEMON=/usr/sbin/dhcpd
pascal@5234 14 OPTIONS=$DHCPD_OPTIONS
pascal@5234 15 PIDFILE=/var/run/dhcpd.pid
pascal@5234 16
pascal@5234 17 case "$1" in
pascal@5234 18 start)
pascal@5234 19 if active_pidfile $PIDFILE dhcpd ; then
pascal@5234 20 echo "$NAME already running."
pascal@5234 21 exit 1
pascal@5234 22 fi
pascal@5234 23 echo -n "Starting $DESC: $NAME... "
pascal@5234 24 $DAEMON $OPTIONS
pascal@5234 25 status
pascal@5234 26 ;;
pascal@5234 27 stop)
pascal@5234 28 if ! active_pidfile $PIDFILE dhcpd ; then
pascal@5234 29 echo "$NAME is not running."
pascal@5234 30 exit 1
pascal@5234 31 fi
pascal@5234 32 echo -n "Stopping $DESC: $NAME... "
pascal@5234 33 kill `cat $PIDFILE`
pascal@5234 34 status
pascal@5234 35 ;;
pascal@5234 36 restart)
pascal@5234 37 if ! active_pidfile $PIDFILE dhcpd ; then
pascal@5234 38 echo "$NAME is not running."
pascal@5234 39 exit 1
pascal@5234 40 fi
pascal@5234 41 echo -n "Restarting $DESC: $NAME... "
pascal@5234 42 kill `cat $PIDFILE`
pascal@5234 43 sleep 2
pascal@5234 44 $DAEMON $OPTIONS
pascal@5234 45 status
pascal@5234 46 ;;
pascal@5234 47 *)
pascal@5234 48 echo ""
pascal@5234 49 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
pascal@5234 50 echo ""
pascal@5234 51 exit 1
pascal@5234 52 ;;
pascal@5234 53 esac
pascal@5234 54
pascal@5234 55 exit 0