summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEldad Zack <eldad@gentoo.org>2004-10-20 16:37:55 +0000
committerEldad Zack <eldad@gentoo.org>2004-10-20 16:37:55 +0000
commit321ca58212b092526e34476395602dba2aa5554c (patch)
tree5628e2486710beed163252753268ca5a9b31ce03 /net-analyzer/nagios-core
parentRemoved EDS support since evolution-data-server is not stable on any arch (Ma... (diff)
downloadgentoo-2-321ca58212b092526e34476395602dba2aa5554c.tar.gz
gentoo-2-321ca58212b092526e34476395602dba2aa5554c.tar.bz2
gentoo-2-321ca58212b092526e34476395602dba2aa5554c.zip
init.d script fixes, bug #67955
Diffstat (limited to 'net-analyzer/nagios-core')
-rw-r--r--net-analyzer/nagios-core/ChangeLog7
-rw-r--r--net-analyzer/nagios-core/files/nagios24
2 files changed, 29 insertions, 2 deletions
diff --git a/net-analyzer/nagios-core/ChangeLog b/net-analyzer/nagios-core/ChangeLog
index 1ddde96663b0..2b5ed34385e1 100644
--- a/net-analyzer/nagios-core/ChangeLog
+++ b/net-analyzer/nagios-core/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for net-analyzer/nagios-core
# Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.39 2004/08/20 13:38:13 eldad Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.40 2004/10/20 16:37:55 eldad Exp $
+
+ 20 Oct 2004; Eldad Zack <eldad@gentoo.org> files/nagios:
+ Added reload function to init.d script, based on a suggestion by Jason Frank
+ <jfrank@kc.rr.com>. Fixed init.d script to check the configuration before
+ start/restart/reload. Closes bug #67955.
*nagios-core-1.2-r3 (20 Aug 2004)
diff --git a/net-analyzer/nagios-core/files/nagios b/net-analyzer/nagios-core/files/nagios
index fd8c0aa2b0d0..20930037cab3 100644
--- a/net-analyzer/nagios-core/files/nagios
+++ b/net-analyzer/nagios-core/files/nagios
@@ -1,14 +1,34 @@
#!/sbin/runscript
# 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.5 2004/07/14 23:04:37 agriffis Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/files/nagios,v 1.6 2004/10/20 16:37:55 eldad Exp $
+
+opts="${opts} reload checkconfig"
depend() {
need net
use dns logger
}
+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"
touch /var/nagios/nagios.log /var/nagios/status.sav
chown nagios:nagios /var/nagios/nagios.log /var/nagios/status.sav
@@ -26,8 +46,10 @@ stop() {
}
svc_restart() {
+ checkconfig || return 1
ebegin "Restarting nagios"
svc_stop
svc_start
eend $?
}
+