init-script 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/sh
  2. #
  3. # Created 2000-01-03 by jaclu@grm.se
  4. #
  5. # nrpe This shell script takes care of starting and stopping
  6. # nrpe.
  7. #
  8. # chkconfig: 2345 80 30
  9. # description: nrpe is a daemon for a remote nagios server, \
  10. # running nagios plugins on this host.
  11. # processname: nrpe
  12. # config: /usr/local/nagios/etc/nrpe.cfg
  13. # Source function library
  14. if [ -f /etc/rc.d/init.d/functions ]; then
  15. . /etc/rc.d/init.d/functions
  16. elif [ -f /etc/init.d/functions ]; then
  17. . /etc/init.d/functions
  18. elif [ -f /etc/rc.d/functions ]; then
  19. . /etc/rc.d/functions
  20. fi
  21. # Source networking configuration.
  22. . /etc/sysconfig/network
  23. # Check that networking is up.
  24. [ ${NETWORKING} = "no" ] && exit 0
  25. prefix=/usr/local/nagios
  26. exec_prefix=${prefix}
  27. NrpeBin=${exec_prefix}/bin/nrpe
  28. NrpeCfg=${prefix}/etc/nrpe.cfg
  29. # See how we were called.
  30. case "$1" in
  31. start)
  32. # Start daemons.
  33. echo -n "Starting nrpe: "
  34. daemon $NrpeBin -d $NrpeCfg
  35. echo
  36. touch /var/lock/subsys/nrpe
  37. ;;
  38. stop)
  39. # Stop daemons.
  40. echo -n "Shutting down nrpe: "
  41. killproc nrpe
  42. echo
  43. rm -f /var/lock/subsys/nrpe
  44. ;;
  45. restart)
  46. $0 stop
  47. $0 start
  48. ;;
  49. status)
  50. status nrpe
  51. ;;
  52. *)
  53. echo "Usage: nrpe {start|stop|restart|status}"
  54. exit 1
  55. esac
  56. exit 0