init-script.suse.in 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #! /bin/sh
  2. # Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany. All rights reserved.
  3. # Modifications for NRPE Copyright (c) 2003 Subhendu Ghosh
  4. # Author: Christopher Mahmood <ckm+snmp@suse.de>, Remo Behn <ray+snmp@suse.de>
  5. # Modifications for NRPE: Subhendu Ghosh <sghosh@users.sourceforge.net>
  6. #
  7. # /etc/init.d/nrpe
  8. #
  9. ### BEGIN INIT INFO
  10. # Provides: nrpe
  11. # Required-Start: $network
  12. # Required-Stop:
  13. # Default-Start: 2 3 5
  14. # Default-Stop: 0 1 6
  15. # Description: start nrpe
  16. ### END INIT INFO
  17. NRPEBIN=@bindir@/nrpe
  18. NRPECFG=@sysconfdir@/nrpe.cfg
  19. test -x $NRPEBIN || exit 5
  20. # Shell functions sourced from /etc/rc.status:
  21. # rc_check check and set local and overall rc status
  22. # rc_status check and set local and overall rc status
  23. # rc_status -v ditto but be verbose in local rc status
  24. # rc_status -v -r ditto and clear the local rc status
  25. # rc_failed set local and overall rc status to failed
  26. # rc_failed <num> set local and overall rc status to <num><num>
  27. # rc_reset clear local rc status (overall remains)
  28. # rc_exit exit appropriate to overall rc status
  29. . /etc/rc.status
  30. # First reset status of this service
  31. rc_reset
  32. # Return values acc. to LSB for all commands but status:
  33. # 0 - success
  34. # 1 - generic or unspecified error
  35. # 2 - invalid or excess argument(s)
  36. # 3 - unimplemented feature (e.g. "reload")
  37. # 4 - insufficient privilege
  38. # 5 - program is not installed
  39. # 6 - program is not configured
  40. # 7 - program is not running
  41. #
  42. # Note that starting an already running service, stopping
  43. # or restarting a not-running service as well as the restart
  44. # with force-reload (in case signalling is not supported) are
  45. # considered a success.
  46. case "$1" in
  47. start)
  48. echo -n "Starting nrpe:"
  49. startproc $NRPEBIN -c $NRPECFG -d
  50. rc_status -v
  51. rc_reset
  52. ;;
  53. stop)
  54. echo -n "Shutting down nrpe:"
  55. killproc -TERM $NRPEBIN
  56. rc_status -v ; rc_reset
  57. ;;
  58. restart)
  59. $0 stop
  60. $0 start
  61. rc_status
  62. ;;
  63. status)
  64. echo -n "Checking for service nrpe:"
  65. checkproc $NRPEBIN
  66. rc_status -v
  67. rc_reset
  68. ;;
  69. *)
  70. echo "Usage: $0 {start|stop|restart|status}"
  71. exit 1
  72. ;;
  73. esac
  74. rc_exit