watchquagga.init 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. # chkconfig: 2345 17 83
  3. ### BEGIN INIT INFO
  4. # Provides: watchquagga
  5. # Short-Description: Quagga watchdog
  6. # Description: Quagga watchdog for use with Zebra
  7. ### END INIT INFO
  8. # source function library
  9. . /etc/rc.d/init.d/functions
  10. # Get network config
  11. . /etc/sysconfig/network
  12. # quagga command line options
  13. . /etc/sysconfig/quagga
  14. RETVAL=0
  15. PROG="watchquagga"
  16. cmd=watchquagga
  17. LOCK_FILE=/var/lock/subsys/watchquagga
  18. case "$1" in
  19. start)
  20. # Check that networking is up.
  21. [ "${NETWORKING}" = "no" ] && exit 1
  22. # Check that there are daemons to be monitored.
  23. [ -z "$WATCH_DAEMONS" ] && exit 1
  24. echo -n $"Starting $PROG: "
  25. daemon $cmd -d $WATCH_OPTS $WATCH_DAEMONS
  26. RETVAL=$?
  27. [ $RETVAL -eq 0 ] && touch $LOCK_FILE
  28. echo
  29. ;;
  30. stop)
  31. echo -n $"Shutting down $PROG: "
  32. killproc $cmd
  33. RETVAL=$?
  34. [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
  35. echo
  36. ;;
  37. restart|reload|force-reload)
  38. $0 stop
  39. $0 start
  40. RETVAL=$?
  41. ;;
  42. condrestart|try-restart)
  43. if [ -f $LOCK_FILE ]; then
  44. $0 stop
  45. $0 start
  46. fi
  47. RETVAL=$?
  48. ;;
  49. status)
  50. status $cmd
  51. RETVAL=$?
  52. ;;
  53. *)
  54. echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
  55. exit 2
  56. esac
  57. exit $RETVAL