diff options
Diffstat (limited to 'net-analyzer/nagios-core/files/nagios4-r1')
-rw-r--r-- | net-analyzer/nagios-core/files/nagios4-r1 | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/net-analyzer/nagios-core/files/nagios4-r1 b/net-analyzer/nagios-core/files/nagios4-r1 new file mode 100644 index 000000000000..dd2495c10953 --- /dev/null +++ b/net-analyzer/nagios-core/files/nagios4-r1 @@ -0,0 +1,46 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +extra_commands="checkconfig" +extra_started_commands="reload" + +nagios_config="/etc/nagios/nagios.cfg" + +command="/usr/sbin/nagios" +command_args="-d ${nagios_config}" +pidfile="/var/nagios/nagios.lock" +start_stop_daemon_args="-e HOME=/var/nagios/home" + +depend(){ + need net + use dns logger firewall + after mysql postgresql +} + +reload(){ + checkconfig || return 1 + ebegin "Reloading configuration" + start-stop-daemon --signal HUP --pidfile ${pidfile} + eend $? +} + +checkconfig(){ + ebegin "Verifying config files" + + # Silent Check + ${command} -v ${nagios_config} > /dev/null 2>&1 && return 0 + + # Now we know there's a problem. Run the check again and + # this time, display the errors. + ${command} -v ${nagios_config} + eend $? "Configuration Error. Please fix your config file." +} + +start_pre() { + # Without this, the "start" action will appear to succeed even + # when the config file contains errors and the daemon failed to + # start. + checkconfig || return 1 +} |