2
1

S80dhcp-server 982 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. # Sanity checks
  9. test -f /usr/sbin/dhcpd || exit 0
  10. test -f /etc/dhcp/dhcpd.conf || exit 0
  11. test -n "$INTERFACES" || exit 0
  12. case "$1" in
  13. start)
  14. echo -n "Starting DHCP server: "
  15. test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
  16. test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
  17. start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES
  18. [ $? = 0 ] && echo "OK" || echo "FAIL"
  19. ;;
  20. stop)
  21. echo -n "Stopping DHCP server: dhcpd3"
  22. start-stop-daemon -K -x /usr/sbin/dhcpd
  23. [ $? = 0 ] && echo "OK" || echo "FAIL"
  24. ;;
  25. restart | force-reload)
  26. $0 stop
  27. sleep 2
  28. $0 start
  29. if [ "$?" != "0" ]; then
  30. exit 1
  31. fi
  32. ;;
  33. *)
  34. echo "Usage: /etc/init.d/dhcp-server {start|stop|restart|force-reload}"
  35. exit 1
  36. esac
  37. exit 0