dsa-check-timedatectl: Accept "Network time on" string also instead of just "NTP...
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-timedatectl
index 700d857..13956d2 100755 (executable)
@@ -34,8 +34,8 @@ timedatectl > "$temp"
 ut=$(sed '/Universal time:/ { s/^[^:]*: *//; p}; d' "$temp")
 rtc=$(sed '/RTC time:/ { s/^[^:]*: *//; p}; d' "$temp")
 
-uts=$(date -d "$ut" +%s)
-rtcs=$(date -d "$rtc" +%s)
+uts=$(TZ=UTC date -d "$ut" +%s)
+rtcs=$(TZ=UTC date -d "$rtc" +%s)
 
 d=$((uts - rtcs))
 
@@ -46,7 +46,7 @@ if [ "$d" -lt "-$MAX" ] ||
 fi
 
 
-bool=$(sed '/NTP enabled:/ { s/^[^:]*: *//; p}; d' "$temp")
+bool=$(sed '/\(NTP enabled\|Network time on\):/ { s/^[^:]*: *//; p}; d' "$temp")
 if [ "$bool" != "yes" ]; then
        echo "Warning: NTP not enabled!"
        exit 1