0
|
1 #!@BASH@
|
|
2 #
|
|
3 # routeflapper This script controls the routeflapper daemon.
|
|
4 #
|
|
5 #
|
|
6 # chkconfig: 2345 60 40
|
|
7 # description: routeflapper monitors the bgp routes for new announcements
|
|
8 # processname: routeflapper
|
|
9 # pidfile: /var/run/routeflapper.pid
|
|
10 # Source function library.
|
|
11 #
|
|
12 . /etc/rc.d/init.d/functions
|
|
13
|
|
14 # Source networking configuration.
|
|
15 . /etc/sysconfig/network
|
|
16
|
|
17 RETVAL=0
|
|
18 # See how we were called.
|
|
19 case "$1" in
|
|
20 start)
|
|
21 # Start daemons.
|
|
22 echo -n "Starting routeflapper: "
|
|
23 if [ ! -f /var/lock/subsys/routeflapper ]; then
|
|
24 cd SYSCONFDIR # conf file is here
|
|
25 SBINDIR/routeflapper -d 3
|
|
26 RETVAL=$?
|
|
27 pid=`pidof -s SBINDIR/routeflapper`
|
|
28 if [ $pid ]
|
|
29 then
|
|
30 success "Starting routeflapper :"
|
|
31 touch /var/lock/subsys/routeflapper
|
|
32 echo
|
|
33 else
|
|
34 failure "Starting routeflapper:"
|
|
35 echo
|
|
36 fi
|
|
37 else
|
|
38 echo -n "already running! "
|
|
39 failure "routeflapper already running!"
|
|
40 echo
|
|
41 fi
|
|
42
|
|
43 ;;
|
|
44 stop)
|
|
45 # Stop daemons.
|
|
46 echo -n "Shutting down routeflapper: "
|
|
47 killproc routeflapper
|
|
48 RETVAL=$?
|
|
49 echo
|
|
50 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/routeflapper
|
|
51 ;;
|
|
52 restart|reload)
|
|
53 $0 stop
|
|
54 $0 start
|
|
55 RETVAL=$?
|
|
56 ;;
|
|
57 status)
|
|
58 status routeflapper
|
|
59 RETVAL=$?
|
|
60 ;;
|
|
61 *)
|
|
62 echo "Usage: routeflapper {start|stop|restart|reload|status}"
|
|
63 exit 1
|
|
64 esac
|
|
65 exit $RETVAL
|