Sophie

Sophie

distrib > Mandriva > 2008.0 > x86_64 > by-pkgid > e364208a5de4ddb647ef6b67eaec7e7a > files > 3

nrpe-2.11-2mdv2008.0.src.rpm

#!/bin/sh
#
# nrpe          This shell script takes care of starting and stopping
#               nrpe.
#
# chkconfig: 2345 80 30
# description: nrpe is a daemon for a remote nagios server, \
#              running nagios plugins on this host.
# processname: nrpe
# config: /etc/nagios/nrpe.cfg

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /etc/nagios/nrpe.cfg ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting nrpe: "
	daemon nrpe -c /etc/nagios/nrpe.cfg -d
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nrpe
	;;
  stop)
	echo -n "Stopping nrpe: "
	killproc nrpe
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nrpe
	;;
  status)
	status nrpe
	RETVAL=$?
	;;
  restart|reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
condrestart)
	[ -f /var/lock/subsys/nrpe ] && $0 restart
	RETVAL=$?
	;;
  *)
	echo "Usage: nrpe {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $RETVAL