#!/bin/sh # # nsca This shell script takes care of starting and stopping # nsca. # # chkconfig: 2345 80 30 # description: nsca is a daemon for accepting service check results \ # from applications running on other hosts. # processname: nsca # config: /etc/nagios/nsca.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/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