#!/bin/ksh
#
# Nagios NRPE startup script
# Written by Robert Moss, RobMossRM@aol.com, 2005-07-21
#

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/bcs/bin:/usr/local/nagios/bin; export PATH
#
# Start/stop nagios
NAGIOS=/usr/local/nagios
#
case "$1" in

'start')
        if [ -x $NAGIOS/bin/nrpe ]; then
                su - nagios -c "$NAGIOS/bin/nrpe -c $NAGIOS/etc/nrpe.cfg -d &" &
        else
                echo "ERROR: Could not execute nrpe!"
        fi
        ;;

'stop')
        pkill nrpe
        ;;

*)
   echo "Usage: $0 { start | stop }"
   ;;

esac
