File rcnrpe of Package nagios-nrpe

#! /bin/sh
#
# Copyright (c) 2008 Novell, Inc
#
# /etc/init.d/nrpe
#   and its symbolic link
# /usr/sbin/rcnrpe
#
### BEGIN INIT INFO
# Provides:          nagios-nrpe
# Required-Start:    $remote_fs $syslog $network
# Should-Start:      cron
# Should-Stop:       cron
# Required-Stop:     $remote_fs $syslog
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: NRPE Nagios Remote Plugin Executor
# Description:       Start NRPE to allow remote execution of
#	Nagios plugins.
### END INIT INFO

NRPE_BIN=/usr/sbin/nrpe
test -x $NRPE_BIN || { echo "$NRPE_BIN not installed";
        if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }

# Check for existence of needed config file and read it
NRPE_CONFIG=/etc/nagios/nrpe.cfg
test -r $NRPE_CONFIG || { echo "$NRPE_CONFIG not existing";
        if [ "$1" = "stop" ]; then exit 0;
	else exit 6; fi; }

. /etc/rc.status

rc_reset
case "$1" in
    start)
	# Start daemons.
	echo -n "Starting Nagios NRPE "
	/sbin/startproc $NRPE_BIN -c $NRPE_CONFIG -d
	
	rc_status -v
	;;
    stop)
	# Stop daemons.
	echo -n "Shutting down Nagios NRPE "
	/sbin/killproc -TERM $NRPE_BIN
	rc_status -v
	;;
    try-restart|condrestart)
        if test "$1" = "condrestart"; then
	        echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
	fi
	$0 status
	if test $? = 0; then
	        $0 restart
	else
		rc_reset
	fi
	rc_status
        ;;
    restart)
	$0 stop
	$0 start
	rc_status
	;;
    reload|force-reload)
	echo -n "Reload service Nagios NRPE "
	/sbin/killproc -HUP $NRPE_BIN
	rc_status -v
        ;;
    status)
  	echo -n "Checking for service Nagios NRPE "
	/sbin/checkproc $NRPE_BIN
	rc_status -v
	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
	exit 1
esac
rc_exit