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