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