]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-relay.init
- added try-restart and force-reload options
[packages/dhcp.git] / dhcp-relay.init
1 #!/bin/sh
2 # DHCP relay agent
3 #
4 # chkconfig:    345 80 20
5 # description:  DHCP relay agent
6
7 # Source function library.
8 . /etc/rc.d/init.d/functions
9
10 # Source networking configuration.
11 . /etc/sysconfig/network
12
13 # Demon specified configuration.
14 OPTIONS=""
15 . /etc/sysconfig/dhcp-relay
16
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
20                 msg_network_down "DHCP realay"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 if [ -n "DHCP_RELAY_INTERFACES" ]; then
28         for iface in $DHCP_RELAY_INTERFACES ; do
29                 OPTIONS="$OPTIONS -i $iface"
30         done
31 fi
32
33 RETVAL=0
34 # See how we were called.
35 case "$1" in
36   start)
37         # Check if the service is already running?
38         if [ ! -f /var/lock/subsys/dhcp-relay ]; then
39                 msg_starting "DHCP relay"
40                 daemon dhcrelay $OPTIONS $DHCP_SERVERS_IP
41                 RETVAL=$?
42                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-relay
43         else
44                 msg_already_running "DHCP relay"
45         fi
46         ;;
47   stop)
48         if [ -f /var/lock/subsys/dhcp-relay ]; then
49                 msg_stopping "DHCP relay"
50                 killproc dhcrelay
51                 rm -f /var/lock/subsys/dhcp-relay
52         else
53                 msg_not_running "DHCP relay"
54         fi
55         ;;
56   restart|force-reload)
57         $0 stop
58         $0 start
59         exit $?
60         ;;
61   status)
62         status dhcrelay
63         exit $?
64         ;;
65   *)
66         msg_usage "$0 {start|stop|restart|force-reload|status}"
67         exit 3
68 esac
69
70 exit $RETVAL
This page took 0.064976 seconds and 3 git commands to generate.