Skip to content

Instantly share code, notes, and snippets.

@Zordrak
Created November 29, 2013 14:29
Show Gist options
  • Save Zordrak/7706459 to your computer and use it in GitHub Desktop.
Save Zordrak/7706459 to your computer and use it in GitHub Desktop.
Slackware ISC DHCPD init script
#!/bin/sh
#
# /etc/rc.d/rc.dhcpd
# This shell script takes care of starting and stopping
# the ISC DHCPD service
#
# Put the command line options here that you want to pass to dhcpd:
DHCPD_OPTIONS="-q eth0"
[ -x /usr/sbin/dhcpd ] || exit 0
[ -f /etc/dhcpd.conf ] || exit 0
start() {
# Start daemons.
echo -n "Starting dhcpd: /usr/sbin/dhcpd $DHCPD_OPTIONS "
/usr/sbin/dhcpd $DHCPD_OPTIONS
echo
}
stop() {
# Stop daemons.
echo -n "Shutting down dhcpd: "
killall -TERM dhcpd
echo
}
status() {
PIDS=$(pidof dhcpd)
if [ "$PIDS" == "" ]; then
echo "dhcpd is not running!"
else
echo "dhcpd is running at pid(s) ${PIDS}."
fi
}
restart() {
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment