# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES=""
-# Allow a few customizations from a config file
-test -r /etc/default/dhcpd && . /etc/default/dhcpd
+NAME="dhcpd"
+DAEMON="/usr/sbin/${NAME}"
+CFG_FILE="/etc/default/${NAME}"
+
+# Read configuration variable file if it is present
+[ -r "${CFG_FILE}" ] && . "${CFG_FILE}"
# Sanity checks
test -f /usr/sbin/dhcpd || exit 0
printf "Starting DHCP server: "
test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
- start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES
+ start-stop-daemon -S -x ${DAEMON} -- -q $INTERFACES
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)
- printf "Stopping DHCP server: dhcpd3"
- start-stop-daemon -K -x /usr/sbin/dhcpd
+ printf "Stopping DHCP server: "
+ start-stop-daemon -K -x ${DAEMON}
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
restart | force-reload)