S80dhcp-relay 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. #
  3. # $Id: dhcp3-relay,v 1.1 2004/04/16 15:41:08 ml Exp $
  4. #
  5. # What servers should the DHCP relay forward requests to?
  6. # e.g: SERVERS="192.168.0.1"
  7. SERVERS=""
  8. # On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
  9. INTERFACES=""
  10. # Additional options that are passed to the DHCP relay daemon?
  11. OPTIONS=""
  12. # Sanity checks
  13. test -f /usr/sbin/dhcrelay || exit 0
  14. test -n "$INTERFACES" || exit 0
  15. test -n "$SERVERS" || exit 0
  16. # Build command line for interfaces (will be passed to dhrelay below.)
  17. IFCMD=""
  18. for I in $INTERFACES; do
  19. IFCMD=${IFCMD}"-i "${I}" "
  20. done
  21. DHCRELAYPID=/var/run/dhcrelay.pid
  22. case "$1" in
  23. start)
  24. echo -n "Starting DHCP relay: "
  25. start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
  26. [ $? = 0 ] && echo "OK" || echo "FAIL"
  27. ;;
  28. stop)
  29. echo -n "Stopping DHCP relay: "
  30. start-stop-daemon -K -x /usr/sbin/dhcrelay
  31. [ $? = 0 ] && echo "OK" || echo "FAIL"
  32. ;;
  33. restart | force-reload)
  34. $0 stop
  35. sleep 2
  36. $0 start
  37. ;;
  38. *)
  39. echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}"
  40. exit 1
  41. esac
  42. exit 0