summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/nagios-core/files/nagios')
-rw-r--r--net-analyzer/nagios-core/files/nagios35
1 files changed, 30 insertions, 5 deletions
diff --git a/net-analyzer/nagios-core/files/nagios b/net-analyzer/nagios-core/files/nagios
index b8c5318ffe8b..012db9c5164c 100644
--- a/net-analyzer/nagios-core/files/nagios
+++ b/net-analyzer/nagios-core/files/nagios
@@ -1,31 +1,56 @@
#!/sbin/runscript
-# Copyright 1999-2002 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License, v2 or later
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/files/nagios,v 1.1.1.1 2005/11/30 10:12:19 chriswhite Exp $
+
+opts="${opts} reload checkconfig"
depend() {
need net
use dns logger
+ after mysql postgresql
+}
+
+reload()
+{
+ checkconfig || return 1
+ ebegin "Reloading configuration"
+ killall -HUP nagios &>/dev/null
+ eend $?
+}
+
+checkconfig() {
+ # Silent Check
+ /usr/nagios/bin/nagios -v /etc/nagios/nagios.cfg &>/dev/null && return 0
+
+ # Now we know there's problem - run again and display errors
+ /usr/nagios/bin/nagios -v /etc/nagios/nagios.cfg
+ eend $? "Configuration Error. Please fix your configfile"
}
start() {
+ checkconfig || return 1
ebegin "Starting nagios"
- su - nagios -c "touch /var/nagios/nagios.log /var/nagios/status.sav"
+ touch /var/nagios/nagios.log /var/nagios/status.sav
+ chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
rm -f /var/nagios/rw/nagios.cmd
- start-stop-daemon -o --quiet --start --startas /usr/nagios/bin/nagios \
+ start-stop-daemon --quiet --start --startas /usr/nagios/bin/nagios \
--pidfile /var/nagios/nagios.lock -- -d /etc/nagios/nagios.cfg
eend $?
}
stop() {
ebegin "Stopping nagios"
- start-stop-daemon -o --quiet --stop --pidfile /var/nagios/nagios.lock
+ start-stop-daemon --quiet --stop --pidfile /var/nagios/nagios.lock
rm -f /var/nagios/status.log /var/nagios/nagios.tmp /var/nagios/nagios.lock /var/nagios/rw/nagios.cmd
eend $?
}
svc_restart() {
+ checkconfig || return 1
ebegin "Restarting nagios"
svc_stop
svc_start
eend $?
}
+