From fd67bb0d2b002741c3abb1c719a86fb051ccaf56 Mon Sep 17 00:00:00 2001 From: frank Date: Tue, 17 Jul 2012 12:33:42 +0200 Subject: [PATCH] saving uncommitted changes in /etc prior to emerge run --- .etckeeper | 4 +--- init.d/nrpe | 32 +++++++++----------------------- nagios/nrpe.cfg | 4 +++- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.etckeeper b/.etckeeper index 22a0bae..1bb5937 100755 --- a/.etckeeper +++ b/.etckeeper @@ -867,9 +867,7 @@ maybe chmod 0755 './init.d/ndo2db' maybe chmod 0755 './init.d/net.lo' maybe chmod 0755 './init.d/netmount' maybe chmod 0755 './init.d/network' -maybe chown nagios './init.d/nrpe' -maybe chgrp nagios './init.d/nrpe' -maybe chmod 0750 './init.d/nrpe' +maybe chmod 0755 './init.d/nrpe' maybe chmod 0755 './init.d/nscd' maybe chmod 0755 './init.d/ntp-client' maybe chmod 0755 './init.d/ntpd' diff --git a/init.d/nrpe b/init.d/nrpe index d83171e..8032a30 100755 --- a/init.d/nrpe +++ b/init.d/nrpe @@ -1,36 +1,22 @@ #!/sbin/runscript -opts="${opts} reload" +extra_started_commands="reload" + +command="/usr/bin/nrpe" +command_args="-c /etc/nagios/nrpe.cfg --daemon" +pidfile="${pidfile:-/var/run/nrpe/nrpe.pid}" +start_stop_daemon_args="--user nagios --group nagios" depend() { need net } -start() { - ebegin "Starting nrpe" - start-stop-daemon --start --quiet --name nrpe \ - --startas /usr/bin/nrpe \ - -c nagios:nagios \ - -- -c /etc/nagios/nrpe.cfg \ - --daemon - eend $? "Failed to Start nrpe" -} - -stop() { - ebegin "Stopping nrpe" - start-stop-daemon --stop --quiet -n nrpe - eend $? "Failed to Stop nrpe" +start_pre() { + checkpath -d -m 0750 -o nagios:nagios /var/run/nrpe } reload() { ebegin "Reloading nrpe" - kill -HUP `pgrep nrpe | head -1` + kill -HUP $(head -n1 ${pidfile}) eend $? "Failed to reload nrpe" } - -restart() { - ebegin "Restarting nrpe" - svc_stop - svc_start - eend $? "Failed to Restart nrpe" -} diff --git a/nagios/nrpe.cfg b/nagios/nrpe.cfg index e121a78..d33b46b 100644 --- a/nagios/nrpe.cfg +++ b/nagios/nrpe.cfg @@ -67,7 +67,9 @@ nrpe_group=nagios # ALLOWED HOST ADDRESSES # This is an optional comma-delimited list of IP address or hostnames -# that are allowed to talk to the NRPE daemon. +# that are allowed to talk to the NRPE daemon. Network addresses with a bit mask +# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently +# supported. # # Note: The daemon only does rudimentary checking of the client's IP # address. I would highly recommend adding entries in your /etc/hosts.allow -- 2.39.5