xref: /OK3568_Linux_fs/yocto/meta-openembedded/meta-networking/recipes-connectivity/dhcp/files/init-relay (revision 4882a59341e53eb6f0b4789bf948001014eff981)
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...
7if [ ! -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
11fi
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.)
18IFCMD=""
19if test "$INTERFACES" != ""; then
20	for I in $INTERFACES; do
21		IFCMD=${IFCMD}"-i "${I}" "
22	done
23fi
24
25DHCRELAYPID=/var/run/dhcrelay.pid
26
27case "$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
42esac
43
44exit 0
45