1#!/bin/sh 2# 3# Last Modified 01-07-2003 Ethan Galstad (nagios@nagios.org) 4# Notes 5# This script takes care of starting and stopping the NSCA daemon. 6# Modeled after init script for NRPE written by jaclu@grm.se 7# 8# chkconfig: 2345 80 30 9# description: nsca is a daemon for accepting service check results \ 10# from applications running on other hosts. 11# processname: nsca 12# config: /usr/local/nagios/etc/nsca.cfg 13 14# Source function library 15if [ -f /etc/rc.d/init.d/functions ]; then 16. /etc/rc.d/init.d/functions 17elif [ -f /etc/init.d/functions ]; then 18. /etc/init.d/functions 19elif [ -f /etc/rc.d/functions ]; then 20. /etc/rc.d/functions 21fi 22 23# Source networking configuration. 24. /etc/sysconfig/network 25 26# Check that networking is up. 27[ ${NETWORKING} = "no" ] && exit 0 28 29NscaBin=@bindir@/nsca 30NscaCfg=@sysconfdir@/nsca.cfg 31LockFile=/var/lock/subsys/nsca 32 33# See how we were called. 34case "$1" in 35 start) 36 # Start daemons. 37 echo -n "Starting nsca: " 38 daemon $NscaBin -s -c $NscaCfg 39 RETVAL=$? 40 echo 41 touch $LockFile 42 ;; 43 stop) 44 # Stop daemons. 45 echo -n "Shutting down nsca: " 46 killproc nsca 47 echo 48 rm -f $LockFile 49 ;; 50 restart) 51 $0 stop 52 $0 start 53 ;; 54 status) 55 status nsca 56 ;; 57 *) 58 echo "Usage: nsca {start|stop|restart|status}" 59 exit 1 60esac 61 62exit 0 63 64 65