diff options
author | Simon Rettberg | 2020-12-18 12:28:34 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-12-18 12:28:34 +0100 |
commit | 88047ab5757a6b761b1c3bc1e66a0bef19e278b8 (patch) | |
tree | 3564f7ed8f8b197def708279a63882c4f5466c4b /satellit_installer | |
parent | [SSPS] Remove jessie-backports (diff) | |
download | setup-scripts-88047ab5757a6b761b1c3bc1e66a0bef19e278b8.tar.gz setup-scripts-88047ab5757a6b761b1c3bc1e66a0bef19e278b8.tar.xz setup-scripts-88047ab5757a6b761b1c3bc1e66a0bef19e278b8.zip |
[SSPS] Make timesync HTTP/2 compatible
Diffstat (limited to 'satellit_installer')
-rwxr-xr-x | satellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh | 14 |
1 files changed, 7 insertions, 7 deletions
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 |