1#!/sbin/runscript
2#
3# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
4#
5# Start/stop the Nagios Data Out Daemon.
6#
7# Goes in /etc/init.d - Config is in /etc/conf.d/ndo2db
8
9NDO2DB_BIN="@sbindir@/ndo2db"
10NDO2DB_PID="@piddir@/ndo2db.pid"
11
12depend() {
13	use logger dns net localmount netmount nfsmount
14}
15
16checkconfig() {
17	# Make sure the config file exists
18	if [ ! -f $NDO2DB_CFG ]; then
19		eerror "You need to setup $NDO2DB_CFG.
20		return 1
21	fi
22	return 0
23}
24
25start() {
26	checkconfig || return 1
27	ebegin "Starting ndo2db"
28	# Make sure we have a sane current directory
29	cd /
30	start-stop-daemon --start --exec $NDO2DB_BIN --pidfile $PID_FILE \
31		-- -c $NDO2DB_CFG -f
32	eend $?
33}
34
35stop() {
36	ebegin "Stopping ndo2db"
37	start-stop-daemon --stop --exec $NDO2DB_BIN --pidfile $PID_FILE
38	eend $?
39}
40