--- nsca-2.9.1/init-script.in 2011-11-08 00:15:56.000000000 +0100 +++ nsca-2.9.1/init-script.in.openmamba 2012-10-24 21:46:14.000000000 +0200 @@ -9,56 +9,69 @@ # description: nsca is a daemon for accepting service check results \ # from applications running on other hosts. # processname: nsca -# config: /usr/local/nagios/etc/nsca.cfg +# config: /etc/nagios/nsca.cfg # Source function library -if [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions -elif [ -f /etc/init.d/functions ]; then -. /etc/init.d/functions -elif [ -f /etc/rc.d/functions ]; then -. /etc/rc.d/functions -fi # Source networking configuration. . /etc/sysconfig/network -# Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 -NscaBin=@bindir@/nsca +NscaBin=@sbindir@/nsca NscaCfg=@sysconfdir@/nsca.cfg LockFile=/var/lock/subsys/nsca +[ -e /etc/sysconfig/nsca ] && . /etc/sysconfig/nsca + +RETVAL=0 + # See how we were called. case "$1" in start) - # Start daemons. + [ -x $NscaBin ] || exit 5 + [ -f $NscaCfg ] || exit 6 + + status nsca >/dev/null 2>&1 && exit 0 + echo -n "Starting nsca: " - daemon $NscaBin -s -c $NscaCfg + daemon $NscaBin $OPTIONS -c $NscaCfg RETVAL=$? echo - touch $LockFile + [ $RETVAL -eq 0 ] && touch $LockFile ;; stop) - # Stop daemons. + status nsca >/dev/null 2>&1 || exit 0 + echo -n "Shutting down nsca: " killproc nsca + RETVAL=$? echo - rm -f $LockFile + [ $RETVAL -eq 0 ] && rm $LockFile ;; restart) $0 stop $0 start ;; + reload) + echo -n $"Reloading nsca: " + killproc nsca -HUP + RETVAL=$? + echo + ;; + condrestart) + [ -e $LockFile ] && restart + RETVAL=$? + ;; status) status nsca + RETVAL=$? ;; *) - echo "Usage: nsca {start|stop|restart|status}" + echo "Usage: nsca {start|stop|restart|reload|condrestart|status}" exit 1 esac -exit 0 - +exit $RETVAL