Skip to content

Commit

Permalink
Make the change backward compatible
Browse files Browse the repository at this point in the history
If the IP is set then chronyc timesync will be used before
starting the application
  • Loading branch information
maseabunikie committed Dec 21, 2023
1 parent 2f53908 commit fc85cb4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down

0 comments on commit fc85cb4

Please sign in to comment.