From fc85cb4d41d7cee7eaed6acb2430a6b892f59057 Mon Sep 17 00:00:00 2001 From: Manuel Segarra-Abad Date: Thu, 21 Dec 2023 14:27:25 +0200 Subject: [PATCH] Make the change backward compatible If the IP is set then chronyc timesync will be used before starting the application --- entrypoint.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 57b6f909..e7102ec7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/bash -e -if [ -z ${SKIP_TIMESYNC_WAIT} ] || - [ "${SKIP_TIMESYNC_WAIT}" == "false" ] || - [ ${SKIP_TIMESYNC_WAIT} -eq 0 ] ; then +if [ -n "${CHRONY_DAEMON_IP}" ]; then # Start chrony client and wait for timesync before doing anything. # If timeout happens the script will give error and container exit with error. # Then the docker daemon will restart the container. @@ -12,10 +10,10 @@ if [ -z ${SKIP_TIMESYNC_WAIT} ] || # TODO: in LMC this step will look like it is stuck. For some unknown # reason the client needs to be restarted if the chrony daemon did not get timesync # when the client was started. - attempts=30 + attempts=10 while [ $attempts -gt 0 ]; do set +e - /usr/bin/chronyc -n -h 127.0.0.1 waitsync 1 0 0 2 + /usr/bin/chronyc -n -h ${CHRONY_DAEMON_IP} waitsync 4 0 0 2 if [ $? -eq 0 ]; then echo "INFO: time sync achieved." break