dhcp/dhcrelay.init

91 lines
2.1 KiB
Text
Raw Permalink Normal View History

2012-02-01 14:24:24 +04:00
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: dhcrelay
2012-02-01 18:09:36 +04:00
# Default-Start: 2 3 4 5
# Default-Stop:
# Should-Start:
2012-02-01 14:24:24 +04:00
# Required-Start: $network
# Required-Stop: $network
2012-02-01 18:09:36 +04:00
# Short-Description: Start and stop the DHCP relay server
# Description: dhcrelay provides the Dynamic Host Configuration Protocol (DHCP)
# relay server. This is required when your DHCP server is on
# another network segment from the clients.
2012-02-01 14:24:24 +04:00
### END INIT INFO
2012-02-01 18:09:36 +04:00
#
# The fields below are left around for legacy tools (will remove later).
#
# chkconfig: - 65 35
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
# processname: dhcrelay
# # pidfile: /var/run/dhcrelay.pid
2012-02-01 14:24:24 +04:00
. /etc/rc.d/init.d/functions
[ -x /usr/sbin/dhcrelay ] || exit 0
# Define SERVERS with a list of one or more DHCP servers where
# DHCP packets are to be relayed to and from. This is mandatory.
SERVERS=""
# Define OPTIONS with any other options to pass to the dhcrelay server.
OPTIONS="-q"
2012-02-01 18:09:36 +04:00
# Values specified in this file override the defaults above.
2012-02-01 14:24:24 +04:00
[ -f /etc/sysconfig/dhcrelay ] && . /etc/sysconfig/dhcrelay
# Check that at least one DHCP server to relay to was specified.
[ "${SERVERS}" = "" ] && exit 0
RETVAL=0
start() {
2012-02-01 18:09:36 +04:00
# Start daemons.
echo -n "Starting dhcrelay: "
daemon /usr/sbin/dhcrelay $OPTIONS $SERVERS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dhcrelay
return $RETVAL
2012-02-01 14:24:24 +04:00
}
stop() {
2012-02-01 18:09:36 +04:00
# Stop daemons.
echo -n "Shutting down dhcrelay: "
killproc dhcrelay
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dhcrelay
return $RETVAL
2012-02-01 14:24:24 +04:00
}
# See how we were called.
case "$1" in
2012-02-01 18:09:36 +04:00
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dhcrelay ]; then
stop
start
RETVAL=$?
fi
;;
status)
status dhcrelay
RETVAL=$?
;;
*)
echo "Usage: dhcrelay {start|stop|restart|condrestart|status}"
exit 1
2012-02-01 14:24:24 +04:00
esac
exit $RETVAL