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