#!/bin/sh # # Created 2000-01-03 by jaclu@grm.se # Rewritten for PLD 2004-06-02 by patrys@pld-linux.org # # 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 . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then msg_network_down "Nagios NRPE daemon" exit 1 fi else exit 0 fi pidfile=/var/run/nrpe/nrpe.pid start() { if [ -f /var/lock/subsys/nrpe ]; then msg_already_running "Nagios NRPE daemon" return fi msg_starting "Nagios NRPE daemon" daemon /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nrpe } stop() { if [ ! -f /var/lock/subsys/nrpe ]; then msg_not_running "Nagios NRPE daemon" return fi msg_stopping "Nagios NRPE daemon" killproc --pidfile $pidfile nrpe rm -f /var/lock/subsys/nrpe } condrestart() { if [ ! -f /var/lock/subsys/nrpe ]; then msg_not_running "Nagios NRPE daemon" RETVAL=$1 return fi stop start } RETVAL=0 case "$1" in start) start ;; stop) stop ;; restart) stop start ;; try-restart) condrestart 0 ;; force-reload) condrestart 7 ;; status) status --pidfile $pidfile nrpe exit $? ;; *) msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}" exit 3 esac exit $RETVAL