From 88047ab5757a6b761b1c3bc1e66a0bef19e278b8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 18 Dec 2020 12:28:34 +0100 Subject: [SSPS] Make timesync HTTP/2 compatible --- .../timesync/usr/local/sbin/redneck-timesync.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'satellit_installer') diff --git a/satellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh b/satellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh index 0175456..5fc8794 100755 --- a/satellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh +++ b/satellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh @@ -38,11 +38,11 @@ ECODE=0 # Request all at once, HEAD only, 2 sec timeout for url in $URLS; do curl -s -m 2 -I "$url" & -done | grep ^Date: | cut -c7- | while read -r line || [ -n "$line" ]; do +done | grep -i ^Date: | cut -c7- | while read -r line || [ -n "$line" ]; do # convert each one to unix timestamp T=$(date -d "$line" +%s) # sanity check - [ -n "$T" ] && [ "$T" -gt 1234567890 ] && echo $T + [ -n "$T" ] && [ "$T" -gt 1234567890 ] && echo "$T" done | sort -n > "$F" # Get the median of the sorted values @@ -57,18 +57,18 @@ if [ "$COUNT" -ge 3 ]; then DIFF=$(( NOW - BEST )) fi if [ "$DIFF" -gt "$MAX_DIFF" ]; then - echo "Clock difference too large ($DIFF seconds); refusing to fix." + echo "Clock difference too large (${DIFF} seconds); refusing to fix." ECODE=1 elif [ "$DIFF" -lt "$MIN_DIFF" ]; then - echo "Clock difference ok (within $MIN_DIFF seconds)" + echo "Clock difference ${DIFF}, ok (within ${MIN_DIFF} seconds)" elif "$DRYRUN"; then - echo "Clock difference is $DIFF, but -s is not passed, not correcting time." + echo "Clock difference is ${DIFF}, but -s is not passed, not correcting time." else - echo "Clock difference is $DIFF seconds, setting..." + echo "Clock difference is ${DIFF} seconds, setting..." date -s "@$BEST" fi else - echo "Not enough time probes from public servers to adjust time" + echo "Not enough time probes ($COUNT) from public servers to adjust time" ECODE=1 fi -- cgit v1.2.3-55-g7522