summaryrefslogtreecommitdiffstats
path: root/satellit_installer
diff options
context:
space:
mode:
Diffstat (limited to 'satellit_installer')
-rwxr-xr-xsatellit_installer/static_files/timesync/usr/local/sbin/redneck-timesync.sh13
1 files changed, 8 insertions, 5 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 7dc538c..33cab2a 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
@@ -18,12 +18,18 @@ while [ "$#" -gt 0 ]; do
esac
done
-if ! $BOOTUP; then
+if $BOOTUP; then
+ MIN_DIFF=7
+ MAX_DIFF=86400
+else
# Not bootup mode, ntpd present, ntpq yields no error:
# Assume ntpd is up and running, so don't do anything
command -v ntpd > /dev/null && ntpq -p > /dev/null 2>&1 && exit 0
# Same for systemd timesync
systemctl -q is-active systemd-timesyncd && exit 0
+ # No other timesync, go
+ MIN_DIFF=4
+ MAX_DIFF=300
fi
@@ -35,8 +41,7 @@ fi
# This can be pretty useful in constrained environments with no
# real time servers accessible.
-MIN_DIFF=30
-MAX_DIFF=86400
+$BOOTUP && /usr/local/sbin/slx-wait-online
URLS="
https://www.uni-freiburg.de
@@ -53,8 +58,6 @@ F=$(mktemp)
NOW=$(date +%s)
ECODE=0
-$BOOTUP && /usr/local/sbin/slx-wait-online
-
# Request all at once, HEAD only, 2 sec timeout
for url in $URLS; do
curl -s -m 2 -I "$url" &