2007-04-26 19:01:43 +00:00
|
|
|
#!/bin/bash
|
2004-09-09 04:11:53 +00:00
|
|
|
#
|
|
|
|
# chkconfig: - 66 34
|
|
|
|
# description: dhcrelay provides a relay for Dynamic Host Control Protocol.
|
|
|
|
|
2007-04-26 19:01:43 +00:00
|
|
|
# Source function library
|
|
|
|
. /etc/init.d/functions
|
2004-09-09 04:11:53 +00:00
|
|
|
|
|
|
|
RETVAL=0
|
2007-04-26 19:01:43 +00:00
|
|
|
prog=dhcrelay
|
|
|
|
dhcrelay=/usr/sbin/dhcrelay
|
|
|
|
lockfile=/var/lock/subsys/dhcrelay
|
2004-09-09 04:11:53 +00:00
|
|
|
|
|
|
|
start() {
|
2007-04-26 19:01:43 +00:00
|
|
|
[ -x $dhcrelay ] || exit 5
|
|
|
|
[ -f /etc/sysconfig/dhcrelay ] || exit 6
|
|
|
|
. /etc/sysconfig/dhcrelay
|
|
|
|
[ -z "$DHCPSERVERS" ] && exit 6
|
|
|
|
echo -n $"Starting $prog: "
|
|
|
|
daemon $dhcrelay $([ -n "$INTERFACES" ] && for int in $INTERFACES ; do echo -n " -i $int" ; done) $DHCPSERVERS
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && touch $lockfile
|
|
|
|
return $RETVAL
|
2004-09-09 04:11:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
2007-04-26 19:01:43 +00:00
|
|
|
echo -n $"Shutting down $prog: "
|
|
|
|
killproc $prog -TERM
|
|
|
|
RETVAL=$?
|
|
|
|
echo
|
|
|
|
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
|
|
|
return $RETVAL
|
2004-09-09 04:11:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# See how we were called.
|
|
|
|
case "$1" in
|
2007-04-26 19:01:43 +00:00
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
reload)
|
|
|
|
RETVAL=3
|
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
condrestart)
|
|
|
|
if [ -f $lockfile ]; then
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status $prog
|
|
|
|
RETVAL=$?
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
|
|
|
RETVAL=3
|
|
|
|
;;
|
2004-09-09 04:11:53 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|