wok annotate dhcp/stuff/dhcpd @ rev 23047
slitaz-i18n-extra: add audacity
author | Richard Dunbar <mojo@slitaz.org> |
---|---|
date | Thu Mar 05 22:11:28 2020 -0500 (2020-03-05) |
parents | ff5fd8788cd9 |
children |
rev | line source |
---|---|
pascal@5234 | 1 #!/bin/sh |
al@19161 | 2 # /etc/init.d/dhcpd: Start, stop and restart Dhcp daemon 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 |
al@19159 | 12 DESC="$(_ '%s daemon' DHCP)" |
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@19621 | 17 for i in $OPTIONS ; do |
pascal@19621 | 18 case "$i" in eth*.*) vconfig set_flag $i 1 1; esac |
pascal@19621 | 19 done |
pascal@19621 | 20 |
pascal@5234 | 21 case "$1" in |
pascal@5234 | 22 start) |
pascal@5234 | 23 if active_pidfile $PIDFILE dhcpd ; then |
al@19159 | 24 _ '%s is already running.' $NAME |
pascal@5234 | 25 exit 1 |
pascal@5234 | 26 fi |
al@19159 | 27 action 'Starting %s: %s...' "$DESC" $NAME |
al@19159 | 28 $DAEMON $OPTIONS |
pascal@5234 | 29 status |
pascal@5234 | 30 ;; |
pascal@5234 | 31 stop) |
pascal@5234 | 32 if ! active_pidfile $PIDFILE dhcpd ; then |
al@19159 | 33 _ '%s is not running.' $NAME |
pascal@5234 | 34 exit 1 |
pascal@5234 | 35 fi |
al@19159 | 36 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 37 kill $(cat $PIDFILE) |
pascal@5234 | 38 status |
pascal@5234 | 39 ;; |
pascal@5234 | 40 restart) |
pascal@5234 | 41 if ! active_pidfile $PIDFILE dhcpd ; then |
al@19159 | 42 _ '%s is not running.' $NAME |
pascal@5234 | 43 exit 1 |
pascal@5234 | 44 fi |
al@19159 | 45 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 46 kill $(cat $PIDFILE) |
pascal@5234 | 47 sleep 2 |
pascal@5234 | 48 $DAEMON $OPTIONS |
pascal@5234 | 49 status |
pascal@5234 | 50 ;; |
pascal@5234 | 51 *) |
al@19159 | 52 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 53 newline |
pascal@5234 | 54 exit 1 |
pascal@5234 | 55 ;; |
pascal@5234 | 56 esac |
pascal@5234 | 57 |
pascal@5234 | 58 exit 0 |