zebra.sh.in 913 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. #
  3. # zebra is the head of the quagga routing beast
  4. #
  5. # PROVIDE: zebra
  6. # REQUIRE: NETWORKING
  7. ##
  8. PATH=/sbin:/bin:/usr/sbin:/usr/bin:@prefix@/sbin:@prefix@/bin
  9. export PATH
  10. if [ -f /etc/rc.subr ]
  11. then
  12. . /etc/rc.subr
  13. fi
  14. name="zebra"
  15. rcvar=$name
  16. required_files="@sysconfdir@/${name}.conf"
  17. command="@prefix@/sbin/${name}"
  18. command_args="-d"
  19. start_precmd="zebra_precmd"
  20. stop_postcmd="zebra_postcmd"
  21. socket_dir=@localstatedir@
  22. pidfile="${socket_dir}/${name}.pid"
  23. zebra_precmd()
  24. {
  25. mkdir -p "${socket_dir}"
  26. chown quagga.quagga "${socket_dir}"
  27. chmod 750 "${socket_dir}"
  28. rc_flags="$(
  29. set -- $rc_flags
  30. while [ $# -ne 0 ]; do
  31. if [ X"$1" = X-P -o X"$1" = X-A ]; then
  32. break
  33. fi
  34. shift
  35. done
  36. if [ $# -eq 0 ]; then
  37. echo "-P 0"
  38. fi
  39. ) $rc_flags"
  40. }
  41. zebra_postcmd()
  42. {
  43. if [ -d "${socketdir}" ]; then
  44. rmdir ${socketdir}
  45. fi
  46. }
  47. load_rc_config $name
  48. run_rc_command "$1"