kdc.init 597 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. #PKG krb5-server
  3. #INIT 70
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${kdc:-NO}" = x"NO" && exit 0
  9. test x"$kdc" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
  10. exec sh $0 start
  11. ;;
  12. start)
  13. if [[ ! -f /etc/krb5kdc/principal ]];then
  14. echo "You need to create a database first!"
  15. echo "Use kdb5_util create -s"
  16. exit 1
  17. fi
  18. /usr/sbin/krb5kdc
  19. /usr/sbin/kadmind &
  20. ;;
  21. stop)
  22. kill $(pgrep -f /usr/sbin/krb5kdc)
  23. kill $(pgrep -f /usr/sbin/kadmind)
  24. ;;
  25. restart)
  26. sh $0 stop
  27. sh $0 start
  28. ;;
  29. *)
  30. echo "Usage: $0 {start | stop | restart}"
  31. exit 1
  32. ;;
  33. esac
  34. exit $?