summaryrefslogtreecommitdiffstats
path: root/satellit_installer
diff options
context:
space:
mode:
authorSimon Rettberg2020-12-18 12:28:34 +0100
committerSimon Rettberg2020-12-18 12:28:34 +0100
commit88047ab5757a6b761b1c3bc1e66a0bef19e278b8 (patch)
tree3564f7ed8f8b197def708279a63882c4f5466c4b /satellit_installer
parent[SSPS] Remove jessie-backports (diff)
downloadsetup-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-xsatellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh14
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