icinga.init 669 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. #PKG icinga
  3. #INIT 80
  4. . /etc/rc.conf
  5. case $1 in
  6. autostop) ;;
  7. autostart)
  8. test x"${icinga:-NO}" = x"NO" && exit 0
  9. exec sh $0 start
  10. ;;
  11. start)
  12. [ -d /var/run/icinga ] || mkdir -p /var/run/icinga
  13. [ -d /var/rw ] || mkdir -p /var/rw
  14. [ -d /var/spool/checkresults ] || mkdir -p /var/spool/checkresults
  15. touch /var/log/icinga.log
  16. chown icinga:icinga /var/log/icinga.log
  17. chown icinga:icinga /var/run/icinga
  18. chown icinga:icinga /var/spool/checkresults
  19. chown icinga:icinga /var/rw
  20. icinga -d /etc/icinga/icinga.cfg
  21. ;;
  22. stop)
  23. kill $(pgrep -f icinga)
  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 $?