Skip to content

Commit

Permalink
Force time to sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems authored Mar 4, 2024
1 parent 7d169fd commit 614442c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wait_for_timesync.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/bin/sh
echo "Waiting for timesync"
while [[ "$(timedatectl status | grep 'System clock synchronized' | awk '{print $4}')" != "yes" ]]; do sleep 1; done
if [[ "$(timedatectl status | grep 'NTP service:' | awk '{print $3}')" == "active" ]];then
echo "Waiting for timesync"
timedatectl set-ntp no || true
timedatectl set-ntp yes;
while [[ "$(timedatectl status | grep 'System clock synchronized' | awk '{print $4}')" != "yes" ]]; do
sleep 1;
done;
fi;

0 comments on commit 614442c

Please sign in to comment.