init-server 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. #
  3. # $Id: dhcp3-server.init.d,v 1.4 2003/07/13 19:12:41 mdz Exp $
  4. #
  5. test -f /usr/sbin/dhcpd || exit 0
  6. # It is not safe to start if we don't have a default configuration...
  7. if [ ! -f /etc/default/dhcp-server ]; then
  8. echo "/etc/default/dhcp-server does not exist! - Aborting..."
  9. exit 0
  10. fi
  11. # Read init script configuration (so far only interfaces the daemon
  12. # should listen on.)
  13. . /etc/default/dhcp-server
  14. case "$1" in
  15. start)
  16. echo -n "Starting DHCP server: "
  17. test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
  18. test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
  19. start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES -user dhcp -group dhcp
  20. echo "."
  21. ;;
  22. stop)
  23. echo -n "Stopping DHCP server: dhcpd3"
  24. start-stop-daemon -K -x /usr/sbin/dhcpd
  25. echo "."
  26. ;;
  27. restart | force-reload)
  28. $0 stop
  29. sleep 2
  30. $0 start
  31. if [ "$?" != "0" ]; then
  32. exit 1
  33. fi
  34. ;;
  35. *)
  36. echo "Usage: /etc/init.d/dhcp-server {start|stop|restart|force-reload}"
  37. exit 1
  38. esac
  39. exit 0