zebra.init 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. # chkconfig: - 15 85
  3. # config: /etc/quagga/zebra.conf
  4. ### BEGIN INIT INFO
  5. # Provides: zebra
  6. # Short-Description: GNU Zebra routing manager
  7. # Description: GNU Zebra routing manager
  8. ### END INIT INFO
  9. # source function library
  10. . /etc/rc.d/init.d/functions
  11. # Get network config
  12. . /etc/sysconfig/network
  13. # quagga command line options
  14. . /etc/sysconfig/quagga
  15. RETVAL=0
  16. PROG="zebra"
  17. cmd=zebra
  18. LOCK_FILE=/var/lock/subsys/zebra
  19. CONF_FILE=/etc/quagga/zebra.conf
  20. case "$1" in
  21. start)
  22. # Check that networking is up.
  23. [ "${NETWORKING}" = "no" ] && exit 1
  24. # The process must be configured first.
  25. [ -f $CONF_FILE ] || exit 6
  26. if [ `id -u` -ne 0 ]; then
  27. echo $"Insufficient privilege" 1>&2
  28. exit 4
  29. fi
  30. echo -n $"Starting $PROG: "
  31. /sbin/ip route flush proto zebra
  32. daemon $cmd -d $ZEBRA_OPTS -f $CONF_FILE
  33. RETVAL=$?
  34. [ $RETVAL -eq 0 ] && touch $LOCK_FILE
  35. echo
  36. ;;
  37. stop)
  38. echo -n $"Shutting down $PROG: "
  39. killproc $cmd
  40. RETVAL=$?
  41. [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
  42. echo
  43. ;;
  44. restart|reload|force-reload)
  45. $0 stop
  46. $0 start
  47. RETVAL=$?
  48. ;;
  49. condrestart|try-restart)
  50. if [ -f $LOCK_FILE ]; then
  51. $0 stop
  52. $0 start
  53. fi
  54. RETVAL=$?
  55. ;;
  56. status)
  57. status $cmd
  58. RETVAL=$?
  59. ;;
  60. *)
  61. echo $"Usage: $0 {start|stop|restart|reload|force-reload|condrestart|try-restart|status}"
  62. exit 2
  63. esac
  64. exit $RETVAL