]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-relay.init
- introduced -client-dirs subpackage that provides:
[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 start() {
34         if [ ! -f /var/lock/subsys/dhcp-relay ]; then
35                 msg_starting "DHCP relay"
36                 daemon /sbin/dhcrelay $OPTIONS $DHCP_SERVERS_IP
37                 RETVAL=$?
38                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-relay
39         else
40                 msg_already_running "DHCP relay"
41         fi
42 }
43
44 stop() {
45         if [ -f /var/lock/subsys/dhcp-relay ]; then
46                 msg_stopping "DHCP relay"
47                 killproc dhcrelay
48                 rm -f /var/lock/subsys/dhcp-relay
49         else
50                 msg_not_running "DHCP relay"
51         fi
52 }
53
54 condrestart() {
55         if [ -f /var/lock/subsys/dhcp-relay ]; then
56                 stop
57                 start
58         else
59                 msg_not_running "DHCP relay"
60                 RETVAL=$1
61         fi
62 }
63
64 RETVAL=0
65 # See how we were called.
66 case "$1" in
67   start)
68         start
69         ;;
70   stop)
71         stop
72         ;;
73   restart)
74         stop
75         start
76         ;;
77   try-restart)
78         condrestart 0
79         ;;
80   force-reload)
81         condrestart 7
82         ;;
83   status)
84         status dhcrelay
85         exit $?
86         ;;
87   *)
88         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
89         exit 3
90 esac
91
92 exit $RETVAL
This page took 0.028841 seconds and 3 git commands to generate.