view routeflapper.rc.in @ 0:48d06780cf77

initial version
author Carl Byington <carl@five-ten-sg.com>
date Tue, 13 May 2008 14:03:10 -0700
parents
children
line wrap: on
line source

#!@BASH@
#
# routeflapper      This script controls the routeflapper daemon.
#
#
# chkconfig: 2345 60 40
# description: routeflapper monitors the bgp routes for new announcements
# processname: routeflapper
# pidfile: /var/run/routeflapper.pid
# Source function library.
#
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

RETVAL=0
# See how we were called.
case "$1" in
    start)
        # Start daemons.
        echo -n "Starting routeflapper: "
        if [ ! -f /var/lock/subsys/routeflapper ]; then
            cd SYSCONFDIR   # conf file is here
            SBINDIR/routeflapper -d 3
            RETVAL=$?
            pid=`pidof -s SBINDIR/routeflapper`
            if [ $pid ]
            then
                success "Starting routeflapper :"
                touch /var/lock/subsys/routeflapper
                echo
            else
                failure "Starting routeflapper:"
                echo
            fi
        else
            echo -n "already running! "
            failure "routeflapper already running!"
            echo
        fi

        ;;
    stop)
        # Stop daemons.
        echo -n "Shutting down routeflapper: "
        killproc routeflapper
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/routeflapper
        ;;
    restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
    status)
        status routeflapper
        RETVAL=$?
        ;;
    *)
        echo "Usage: routeflapper {start|stop|restart|reload|status}"
        exit 1
esac
exit $RETVAL