]>
Commit | Line | Data |
---|---|---|
332ceb62 | 1 | #!/bin/sh |
a5333732 | 2 | # DHCP relay agent |
332ceb62 | 3 | # |
31822625 | 4 | # chkconfig: 345 80 20 |
a5333732 | 5 | # description: DHCP relay agent |
332ceb62 | 6 | |
7 | # Source function library. | |
8 | . /etc/rc.d/init.d/functions | |
9 | ||
3b314dfa JR |
10 | # Source networking configuration. |
11 | . /etc/sysconfig/network | |
12 | ||
13 | # Demon specified configuration. | |
14 | . /etc/sysconfig/dhcp-relay | |
332ceb62 | 15 | |
3b314dfa | 16 | # Check that networking is up. |
dfbb7f59 | 17 | if is_yes "${NETWORKING}"; then |
d91f786f | 18 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then |
dfbb7f59 | 19 | msg_network_down "DHCP realay" |
20 | exit 1 | |
21 | fi | |
22 | else | |
23 | exit 0 | |
3b314dfa | 24 | fi |
332ceb62 | 25 | |
dde046a6 | 26 | if [ -n "DHCP_REALY_INTERFACES" ]; then |
27 | OPTIONS="-i $DHCP_REALY_INTERFACES" | |
28 | fi | |
29 | ||
915cd150 | 30 | RETVAL=0 |
332ceb62 | 31 | # See how we were called. |
32 | case "$1" in | |
33 | start) | |
a5333732 | 34 | # Check if the service is already running? |
6dfd82ed | 35 | if [ ! -f /var/lock/subsys/dhcp-relay ]; then |
a5333732 | 36 | msg_starting "DHCP relay" |
37 | daemon dhcrelay $OPTIONS $DHCP_SERVERS_IP | |
38 | RETVAL=$? | |
6dfd82ed | 39 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcp-relay |
a5333732 | 40 | else |
badf1526 | 41 | msg_already_running "DHCP relay" |
13f26ef2 | 42 | fi |
332ceb62 | 43 | ;; |
44 | stop) | |
915cd150 | 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 | |
332ceb62 | 52 | ;; |
915cd150 | 53 | restart|force-reload) |
332ceb62 | 54 | $0 stop |
55 | $0 start | |
915cd150 | 56 | exit $? |
332ceb62 | 57 | ;; |
58 | status) | |
ddd9a79d | 59 | status dhcrelay |
915cd150 | 60 | exit $? |
332ceb62 | 61 | ;; |
62 | *) | |
915cd150 | 63 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
64 | exit 3 | |
332ceb62 | 65 | esac |
66 | ||
a5333732 | 67 | exit $RETVAL |