init-script 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. NrpeBin=/usr/local/nagios/bin/nrpe
  26. NrpeCfg=/usr/local/nagios/etc/nrpe.cfg
  27. LockFile=/var/lock/subsys/nrpe
  28. # See how we were called.
  29. case "$1" in
  30. start)
  31. # Start daemons.
  32. echo -n "Starting nrpe: "
  33. daemon $NrpeBin -d $NrpeCfg
  34. echo
  35. touch $LockFile
  36. ;;
  37. stop)
  38. # Stop daemons.
  39. echo -n "Shutting down nrpe: "
  40. killproc nrpe
  41. echo
  42. rm -f $LockFile
  43. ;;
  44. restart)
  45. $0 stop
  46. $0 start
  47. ;;
  48. status)
  49. status nrpe
  50. ;;
  51. *)
  52. echo "Usage: nrpe {start|stop|restart|status}"
  53. exit 1
  54. esac
  55. exit 0