watchquagga.init 1.1 KB

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