summaryrefslogtreecommitdiffstats
path: root/satellit_installer
diff options
context:
space:
mode:
authorSimon Rettberg2023-09-29 16:45:07 +0200
committerSimon Rettberg2023-09-29 16:45:07 +0200
commit2b4cb4ac5e26bf2a14069e43dcc5d6b810af8e74 (patch)
treee7d89ca5db7350492664e40f869b52619dca70e3 /satellit_installer
parent[SSPS] timesync: Add cronjob to sync once a day (diff)
downloadsetup-scripts-2b4cb4ac5e26bf2a14069e43dcc5d6b810af8e74.tar.gz
setup-scripts-2b4cb4ac5e26bf2a14069e43dcc5d6b810af8e74.tar.xz
setup-scripts-2b4cb4ac5e26bf2a14069e43dcc5d6b810af8e74.zip
[SSPS] timesync: Dynamic limits based on mode (boot/non-boot)
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" &