aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rwxr-xr-xdebian/sitesummary.cron.daily15
2 files changed, 13 insertions, 4 deletions
diff --git a/debian/changelog b/debian/changelog
index 6ddedc5..810af59 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ sitesummary (0.0.53) UNRELEASED; urgency=low
* Generate Nagios checks for software raid, zombie processes, swap,
dns, imaps, nfs and squid too. Rename Nagios services to use
lower case characters.
+ * Only reload Nagios in cron job if the generated configuration
+ changed.
-- Petter Reinholdtsen <pere@debian.org> Thu, 07 Jan 2010 20:03:00 +0100
diff --git a/debian/sitesummary.cron.daily b/debian/sitesummary.cron.daily
index a565331..a6d54f1 100755
--- a/debian/sitesummary.cron.daily
+++ b/debian/sitesummary.cron.daily
@@ -74,8 +74,6 @@ EOF
generate_nagios_config() {
(
- printf "# Generated "; date
-
sitesummary-nodes -n
if [ -f $NAGIOSDIR/nagios-generated.cfg.post ] ; then
@@ -84,8 +82,15 @@ generate_nagios_config() {
true
) > $NAGIOSDIR/nagios-generated.cfg.new && \
- chmod a+r $NAGIOSDIR/nagios-generated.cfg.new && \
+ chmod a+r $NAGIOSDIR/nagios-generated.cfg.new
+ if cmp $NAGIOSDIR/nagios-generated.cfg.new $NAGIOSDIR/nagios-generated.cfg
+ then
+ rm $NAGIOSDIR/nagios-generated.cfg.new
+ false
+ else
mv $NAGIOSDIR/nagios-generated.cfg.new $NAGIOSDIR/nagios-generated.cfg
+ true
+ fi
}
# Only enable if munin and sitesummary is installed.
@@ -95,7 +100,8 @@ fi
# Only enable if nagios v3 and sitesummary is installed.
if [ -f /etc/init.d/nagios3 ] && [ -x /usr/sbin/sitesummary-nodes ]; then
- generate_nagios_config
+ # Only reload nagios if the configuration changed
+ if generate_nagios_config ; then
# subshell to avoid passing all variables from
# /etc/default/nagios3 to other parts of this script
(
@@ -109,6 +115,7 @@ if [ -f /etc/init.d/nagios3 ] && [ -x /usr/sbin/sitesummary-nodes ]; then
invoke-rc.d nagios3 reload >/dev/null
fi
)
+ fi
fi
[ -d $entriesdir ] && remove_old_entries