1 |
#!/bin/sh |
#!/bin/sh |
2 |
# |
# |
|
# dhcrelay This shell script takes care of starting and stopping |
|
|
# dhcrelay. |
|
|
# |
|
|
# chkconfig: 2345 65 35 |
|
|
# description: dhcrelay provides the DHCP Relay service. |
|
|
# |
|
|
# processname: dhcrelay |
|
|
# pidfile: /var/run/dhcrelay.pid |
|
|
# |
|
3 |
### BEGIN INIT INFO |
### BEGIN INIT INFO |
4 |
# Provides: dhcrelay |
# Provides: dhcrelay |
|
# Required-Start: $network |
|
|
# Required-Stop: $network |
|
5 |
# Default-Start: 2 3 4 5 |
# Default-Start: 2 3 4 5 |
6 |
# Default-Stop: |
# Default-Stop: |
7 |
# Short-Description: The dhcrelay daemon |
# Should-Start: |
8 |
# Description: dhcrelay provides the DHCP Relay service. |
# Required-Start: $network |
9 |
|
# Required-Stop: $network |
10 |
|
# Short-Description: Start and stop the DHCP relay server |
11 |
|
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP) |
12 |
|
# relay server. This is required when your DHCP server is on |
13 |
|
# another network segment from the clients. |
14 |
### END INIT INFO |
### END INIT INFO |
15 |
|
# |
16 |
|
# The fields below are left around for legacy tools (will remove later). |
17 |
|
# |
18 |
|
# chkconfig: - 65 35 |
19 |
|
# description: dhcrelay provides a relay for Dynamic Host Control Protocol. |
20 |
|
# processname: dhcrelay |
21 |
|
# # pidfile: /var/run/dhcrelay.pid |
22 |
|
|
|
# Source function library. |
|
23 |
. /etc/rc.d/init.d/functions |
. /etc/rc.d/init.d/functions |
24 |
|
|
|
# Source networking configuration. |
|
|
. /etc/sysconfig/network |
|
|
|
|
|
# Check that networking is up. |
|
|
[ ${NETWORKING} = "no" ] && exit 0 |
|
|
|
|
25 |
[ -x /usr/sbin/dhcrelay ] || exit 0 |
[ -x /usr/sbin/dhcrelay ] || exit 0 |
26 |
|
|
27 |
# The following variables can be set in the file |
# The following variables can be set in the file |
47 |
RETVAL=0 |
RETVAL=0 |
48 |
|
|
49 |
start() { |
start() { |
50 |
# Start daemons. |
# Start daemons. |
51 |
echo -n "Starting dhcrelay: " |
echo -n "Starting dhcrelay: " |
52 |
daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS |
daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS |
53 |
RETVAL=$? |
RETVAL=$? |
54 |
echo |
echo |
55 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay |
56 |
return $RETVAL |
return $RETVAL |
57 |
} |
} |
58 |
|
|
59 |
stop() { |
stop() { |
60 |
# Stop daemons. |
# Stop daemons. |
61 |
echo -n "Shutting down dhcrelay: " |
echo -n "Shutting down dhcrelay: " |
62 |
killproc dhcrelay |
killproc dhcrelay |
63 |
RETVAL=$? |
RETVAL=$? |
64 |
echo |
echo |
65 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay |
66 |
return $RETVAL |
return $RETVAL |
67 |
} |
} |
68 |
|
|
69 |
# See how we were called. |
# See how we were called. |
70 |
case "$1" in |
case "$1" in |
71 |
start) |
start) |
72 |
start |
start |
73 |
;; |
;; |
74 |
stop) |
stop) |
75 |
stop |
stop |
76 |
;; |
;; |
77 |
restart|reload) |
restart|reload) |
78 |
stop |
stop |
79 |
start |
start |
80 |
RETVAL=$? |
RETVAL=$? |
81 |
;; |
;; |
82 |
condrestart) |
condrestart) |
83 |
if [ -f /var/lock/subsys/dhcrelay ]; then |
if [ -f /var/lock/subsys/dhcrelay ]; then |
84 |
stop |
stop |
85 |
start |
start |
86 |
RETVAL=$? |
RETVAL=$? |
87 |
fi |
fi |
88 |
;; |
;; |
89 |
status) |
status) |
90 |
status dhcrelay |
status dhcrelay |
91 |
RETVAL=$? |
RETVAL=$? |
92 |
;; |
;; |
93 |
*) |
*) |
94 |
echo "Usage: dhcrelay {start|stop|restart|condrestart|status}" |
echo "Usage: dhcrelay {start|stop|restart|condrestart|status}" |
95 |
exit 1 |
exit 1 |
96 |
esac |
esac |
97 |
|
|
98 |
exit $RETVAL |
exit $RETVAL |