aboutsummaryrefslogtreecommitdiff
path: root/nagios-downtime
diff options
context:
space:
mode:
Diffstat (limited to 'nagios-downtime')
-rwxr-xr-xnagios-downtime7
1 files changed, 7 insertions, 0 deletions
diff --git a/nagios-downtime b/nagios-downtime
index 6493dcf..46de12e 100755
--- a/nagios-downtime
+++ b/nagios-downtime
@@ -108,6 +108,13 @@ if ((dtn > dtb)) ; then
exit 1
fi
+# If the end time is less than the start time, this is definitely a mistake
+if ((dta > dtb)) ; then
+ printf '%s: Refusing to schedule downtime that ends (%s) before it starts (%s)\n' \
+ "$self" "$(date -d @"$dtb" +%c)" "$(date -d @"$dta" +%c)"
+ exit 1
+fi
+
# Quietly replace semicolons in comment with commas
comment=${comment//;/,}