aboutsummaryrefslogtreecommitdiffstats
path: root/debian/sitesummary.cron.daily
diff options
context:
space:
mode:
Diffstat (limited to 'debian/sitesummary.cron.daily')
-rwxr-xr-xdebian/sitesummary.cron.daily15
1 files changed, 11 insertions, 4 deletions
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