summaryrefslogtreecommitdiffstats
path: root/external/meta-virtualization/recipes-extended/nagios/nagios-nsca/init-script.in
blob: a76b34ed9d2d570634b5b819c12d285c75705ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
#  Last Modified 01-07-2003 Ethan Galstad (nagios@nagios.org)
#  Notes
#  This script takes care of starting and stopping the NSCA daemon.
#  Modeled after init script for NRPE written by jaclu@grm.se
#
# chkconfig: 2345 80 30
# 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

### BEGIN INIT INFO
# Provides:          nsca
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: start and stop nagios nsca daemon
# Description:       start and stop nagios nsca daemon
### END INIT INFO


# 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

NscaBin=@bindir@/nsca
NscaCfg=@sysconfdir@/nsca.cfg
LockFile=/var/lock/nsca

# See how we were called.
case "$1" in
  start)
	# Start daemons.
	echo -n "Starting nsca: "
	start-stop-daemon --start --exec $NscaBin -- -s -c $NscaCfg
	RETVAL=$?
	echo
	touch $LockFile
	;;
  stop)
	# Stop daemons.
	echo -n "Shutting down nsca: "
	start-stop-daemon --stop --exec $NscaBin
	echo
	rm -f $LockFile
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	status nsca
	;;
  *)
	echo "Usage: nsca {start|stop|restart|status}"
	exit 1
esac

exit 0