How to auto-start NRPE daemon on reboot (FreeBSD) ?
Sean Schertell
sean at datafly.net
Sat Sep 1 00:55:47 CEST 2007
Hi Guys,
I've got a spiffy new rc.d script that works great for starting/
stopping the nrpe daemon. But simply adding nrpe_enable="yes" to my /
etc/rc.conf doesn't seem to do the trick.
Does anyone know how I can tell FreeBSD to fire off the "/usr/local/
etc/rc.d/nrpe start" command at boot time?
In case anyone's interested, here's my script:
#!/bin/sh
#
# Startup script for NRPE
#
# Source function library.
. /usr/local/etc/rc.d/functions
BIN=/usr/local/nagios/bin/nrpe
CONFIG=/usr/local/nagios/etc/nrpe.cfg
LOCK=/var/spool/lock/nrpe
RETVAL=0;
# See how we were called.
case "$1" in
start)
echo -n "Starting NRPE daemon: "
daemon $BIN -c $CONFIG -d
RETVAL=$?
if [ $RETVAL = 0 ] && touch $LOCK
then
echo -e "\t\t[ OK ]";
else
echo -e "\t\t[ FAILED ]";
fi
;;
stop)
echo -n "Stopping NRPE daemon: "
kill `cat /var/run/nrpe.pid` && rm -f /var/run/nrpe.pid
RETVAL=$?
if [ $RETVAL = 0 ] && rm -f $LOCK
then
echo -e "\t\t[ OK ]";
else
echo -e "\t\t[ FAILED ]";
fi
;;
status)
status nrpe
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
:::: DataFly.Net ::::
Complete Web Services
http://www.datafly.net
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list