Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix init db check
  • Loading branch information
thespad committed Aug 13, 2024
commit ec0e321583860062bcfa39d6ed34f547923ccf50
14 changes: 4 additions & 10 deletions root/etc/s6-overlay/s6-rc.d/init-speedtest-tracker-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ elif [[ "${DB_CONNECTION}" = "mysql" ]]; then
END=$((SECONDS + 30))
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then
if [[ -n "${RUN}" ]]; then
break
fi
RUN="RAN"
# we sleep here again due to first run init on DB containers
if [[ ! -f /dbwait.lock ]]; then
sleep 5
fi
touch /dbwait.lock
break
else
sleep 1
fi
Expand All @@ -44,14 +41,11 @@ elif [[ "${DB_CONNECTION}" = "pgsql" ]]; then
END=$((SECONDS + 30))
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
if pg_isready -h "${DB_HOST}" -p "${DB_PORT}" -q; then
if [[ -n "${RUN}" ]]; then
break
fi
RUN="RAN"
# we sleep here again due to first run init on DB containers
if [[ ! -f /dbwait.lock ]]; then
sleep 5
fi
touch /dbwait.lock
break
else
sleep 1
fi
Expand Down