S80dhcp-server 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. #
  3. # $Id: dhcp3-server.init.d,v 1.4 2003/07/13 19:12:41 mdz Exp $
  4. #
  5. # On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
  6. # Separate multiple interfaces with spaces, e.g. "eth0 eth1".
  7. INTERFACES=""
  8. # Additional options that are passed to the DHCP server daemon?
  9. OPTIONS=""
  10. NAME="dhcpd"
  11. DAEMON="/usr/sbin/${NAME}"
  12. CFG_FILE="/etc/default/${NAME}"
  13. # Read configuration variable file if it is present
  14. [ -r "${CFG_FILE}" ] && . "${CFG_FILE}"
  15. # Sanity checks
  16. test -f /usr/sbin/dhcpd || exit 0
  17. test -f /etc/dhcp/dhcpd.conf || exit 0
  18. case "$1" in
  19. start)
  20. printf "Starting DHCP server: "
  21. test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
  22. test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
  23. start-stop-daemon -S -q -x ${DAEMON} -- -q $OPTIONS $INTERFACES
  24. [ $? = 0 ] && echo "OK" || echo "FAIL"
  25. ;;
  26. stop)
  27. printf "Stopping DHCP server: "
  28. start-stop-daemon -K -q -x ${DAEMON}
  29. [ $? = 0 ] && echo "OK" || echo "FAIL"
  30. ;;
  31. restart | force-reload)
  32. $0 stop
  33. $0 start
  34. if [ "$?" != "0" ]; then
  35. exit 1
  36. fi
  37. ;;
  38. *)
  39. echo "Usage: $0 {start|stop|restart|force-reload}"
  40. exit 1
  41. esac
  42. exit 0