init-relay 984 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. #
  3. # $Id: dhcp3-relay,v 1.1 2004/04/16 15:41:08 ml Exp $
  4. #
  5. # It is not safe to start if we don't have a default configuration...
  6. if [ ! -f /etc/default/dhcp-relay ]; then
  7. echo "/etc/default/dhcp-relay does not exist! - Aborting..."
  8. echo "create this file to fix the problem."
  9. exit 1
  10. fi
  11. # Read init script configuration (interfaces the daemon should listen on
  12. # and the DHCP server we should forward requests to.)
  13. . /etc/default/dhcp-relay
  14. # Build command line for interfaces (will be passed to dhrelay below.)
  15. IFCMD=""
  16. if test "$INTERFACES" != ""; then
  17. for I in $INTERFACES; do
  18. IFCMD=${IFCMD}"-i "${I}" "
  19. done
  20. fi
  21. DHCRELAYPID=/run/dhcrelay.pid
  22. case "$1" in
  23. start)
  24. start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
  25. ;;
  26. stop)
  27. start-stop-daemon -K -x /usr/sbin/dhcrelay
  28. ;;
  29. restart | force-reload)
  30. $0 stop
  31. sleep 2
  32. $0 start
  33. ;;
  34. *)
  35. echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}"
  36. exit 1
  37. esac
  38. exit 0