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/files
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/files')
-rw-r--r--net-analyzer/nagios-core/files/nagios24
1 files changed, 23 insertions, 1 deletions
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 $?
}
+