From 2b4cb4ac5e26bf2a14069e43dcc5d6b810af8e74 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 29 Sep 2023 16:45:07 +0200 Subject: [SSPS] timesync: Dynamic limits based on mode (boot/non-boot) --- .../timesync/usr/local/sbin/redneck-timesync.sh | 13 ++++++++----- 1 file 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" & -- cgit v1.2.3-55-g7522