9faa13d568f82bf4fda8220811c89d500f391c69
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / dhcp / S80dhcp-relay
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"
8 SERVERS=""
9
10 # On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
11 INTERFACES=""
12
13 # Additional options that are passed to the DHCP relay daemon?
14 OPTIONS=""
15
16 # Sanity checks
17 test -f /usr/sbin/dhcrelay || exit 0
18 test -n "$INTERFACES" || exit 0
19 test -n "$SERVERS" || exit 0
20
21 # Build command line for interfaces (will be passed to dhrelay below.)
22 IFCMD=""
23 for I in $INTERFACES; do
24         IFCMD=${IFCMD}"-i "${I}" "
25 done
26
27 DHCRELAYPID=/var/run/dhcrelay.pid
28
29 case "$1" in
30         start)
31                 echo -n "Starting DHCP relay: "
32                 start-stop-daemon -S -x /usr/sbin/dhcrelay -- -q $OPTIONS $IFCMD $SERVERS
33                 [ $? = 0 ] && echo "OK" || echo "FAIL"
34                 ;;
35         stop)
36                 echo -n "Stopping DHCP relay: "
37                 start-stop-daemon -K -x /usr/sbin/dhcrelay
38                 [ $? = 0 ] && echo "OK" || echo "FAIL"
39                 ;;
40         restart | force-reload)
41                 $0 stop
42                 sleep 2
43                 $0 start
44                 ;;
45         *)
46                 echo "Usage: /etc/init.d/dhcp-relay {start|stop|restart|force-reload}"
47                 exit 1
48 esac
49
50 exit 0