diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2011-12-30 15:34:02 +0000 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2011-12-30 15:34:02 +0000 |
commit | 3a2398693ad8d74fed9a2d96dfa8308111954790 (patch) | |
tree | dea9ad65ba6b818ec01bad92e3a91e9ac8ff42b6 /net-analyzer | |
parent | Relax version for dependency on net-libs/miniupnpc (diff) | |
download | gentoo-2-3a2398693ad8d74fed9a2d96dfa8308111954790.tar.gz gentoo-2-3a2398693ad8d74fed9a2d96dfa8308111954790.tar.bz2 gentoo-2-3a2398693ad8d74fed9a2d96dfa8308111954790.zip |
Rewrote init script. Fixed deprecated s-s-d options. Let reload function use s-s-d as well (bug #392929)
(Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
Diffstat (limited to 'net-analyzer')
-rw-r--r-- | net-analyzer/nagios-core/ChangeLog | 8 | ||||
-rw-r--r-- | net-analyzer/nagios-core/files/nagios3 | 50 |
2 files changed, 30 insertions, 28 deletions
diff --git a/net-analyzer/nagios-core/ChangeLog b/net-analyzer/nagios-core/ChangeLog index c4f990d2b93d..0b7284a9a831 100644 --- a/net-analyzer/nagios-core/ChangeLog +++ b/net-analyzer/nagios-core/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for net-analyzer/nagios-core # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.181 2011/08/27 17:38:06 armin76 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.182 2011/12/30 15:34:02 polynomial-c Exp $ + + 30 Dec 2011; Lars Wendler <polynomial-c@gentoo.org> files/nagios3: + non-maintainer commit: Massively rewrote init script with help from idl0r. + Fixed deprecated s-s-d options. Let reload function use s-s-d as well. Thanks + to Michael Kensington for reporting this in bug #392929 and providing a + patch. 27 Aug 2011; Raúl Porcel <armin76@gentoo.org> nagios-core-3.3.1.ebuild: alpha/sparc stable wrt #371302 diff --git a/net-analyzer/nagios-core/files/nagios3 b/net-analyzer/nagios-core/files/nagios3 index 83b9332b47df..955cb87a65bd 100644 --- a/net-analyzer/nagios-core/files/nagios3 +++ b/net-analyzer/nagios-core/files/nagios3 @@ -1,9 +1,18 @@ #!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/files/nagios3,v 1.1 2008/04/27 18:41:25 dertobi123 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/files/nagios3,v 1.2 2011/12/30 15:34:02 polynomial-c Exp $ -opts="${opts} reload checkconfig" +extra_commands="checkconfig" +extra_started_commands="reload" + +nagios_config="/etc/nagios/nagios.cfg" +nagios_cmdfile="/var/nagios/rw/nagios.cmd" + +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 @@ -15,43 +24,30 @@ reload() { checkconfig || return 1 ebegin "Reloading configuration" - killall -HUP nagios &>/dev/null + start-stop-daemon --signal HUP --pidfile ${pidfile} eend $? } checkconfig() { + ebegin "Verifiyng config files" + # Silent Check - /usr/sbin/nagios -v /etc/nagios/nagios.cfg &>/dev/null && return 0 + /usr/sbin/nagios -v ${nagios_config} &>/dev/null && return 0 # Now we know there's problem - run again and display errors - /usr/sbin/nagios -v /etc/nagios/nagios.cfg + /usr/sbin/nagios -v ${nagios_config} eend $? "Configuration Error. Please fix your configfile" } -start() { +start_pre() { 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 - rm -f /var/nagios/rw/nagios.cmd - start-stop-daemon --quiet --start --startas /usr/sbin/nagios \ - -e HOME="/var/nagios/home" --pidfile /var/nagios/nagios.lock \ - -- -d /etc/nagios/nagios.cfg - eend $? + rm -f ${nagios_cmdfile} } -stop() { - ebegin "Stopping nagios" - 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 $? +stop_post() { + rm -f /var/nagios/status.log /var/nagios/nagios.tmp ${pidfile} \ + ${nagios_cmdfile} } - -svc_restart() { - checkconfig || return 1 - ebegin "Restarting nagios" - svc_stop - svc_start - eend $? -} - |