All pastes #791462 Raw Edit

dhcpd bootscripts

public text v1 · immutable
·published 2007-11-20 22:03 UTC
rendered paste body
---- rc.dhcpd.conf

# Specify which interfaces dhcpd should listen (space seperated list).
# If the list is empty rc.dhcpd will flag a warning and exit.
#
# The config file for dhcpd itself is /etc/dhcpd.conf
#
# exable: DHCPIFACES="eth0 eth3"
DHCPIFACES=""



---- rc.dhcpd -----

#!/bin/sh
# Start/stop/restart the DHCP server

if [ -r /etc/rc.d/rc.dhcpd.conf ]; then
  source /etc/rc.d/rc.dhcpd.conf
else
  echo "FATAL: /etc/rc.d/rc.dhcpd.conf is missing or has non-readable permission."
  exit 1
fi

if [ ! -r /etc/dhcpd.conf ]; then
  echo "FATAL: /etc/dhcpd.conf is missing or has non-readable permission."
  exit 1
fi

dhcpd_start() {
  if [ -n "$DHCPIFACES" ]; then
    /usr/sbin/dhcpd $DHCPIFACES
  else
    echo "FATAL: dhcpd has not been configured. See /etc/rc.d/rc.dhcpd.conf"
    echo "       and /etc/dhcpd.conf for details."
    exit 1
  fi
}

dhcpd_stop() {
  killall dhcpd
}

dhcpd_restart() {
  if [ -r /var/run/dhcpd.pid ]; then
    killall dhcpd
  else
    echo "WARNING: There does not appear to be an instance of dhcpd running."
    echo "         Attempting to start one now."
  fi
  sleep 1
  dhcpd_start
}

case "$1" in
'start')
  dhcpd_start
  ;;
'stop')
  dhcpd_stop
  ;;
'restart')
  dhcpd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac