#!/bin/sh # # chkconfig: 2345 80 30 ### BEGIN INIT INFO # Provides: nsca # Required-Start: $network # Requires-Stop: $network # Default-Start: 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts and stops NSCA # Description: Nagios Send Check Agent daemon ### END INIT INFO # 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/nsca.cfg ] || exit 0 RETVAL=0 # See how we were called. case "$1" in start) echo -n "Starting nsca: " daemon nsca -c /etc/nagios/nsca.cfg -d RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/nsca ;; stop) echo -n "Stopping nsca: " killproc nsca RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nsca ;; status) status nsca RETVAL=$? ;; restart|reload) $0 stop $0 start RETVAL=$? ;; condrestart) [ -f /var/lock/subsys/nsca ] && $0 restart RETVAL=$? ;; *) echo "Usage: nsca {start|stop|status|restart|condrestart|reload}" exit 1 esac exit $RETVAL