Skip to content

Commit 7d28720

Browse files
authored
Merge pull request #142 from linuxserver/db-check
Cleanup db check so it doesn't spam the console
2 parents 240d123 + 3d02d09 commit 7d28720

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ RUN \
1616
composer && \
1717
echo "**** install runtime packages ****" && \
1818
apk add --no-cache \
19-
curl \
2019
fontconfig \
2120
memcached \
22-
netcat-openbsd \
2321
php8-ctype \
2422
php8-curl \
2523
php8-dom \

Dockerfile.aarch64

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ RUN \
1616
composer && \
1717
echo "**** install runtime packages ****" && \
1818
apk add --no-cache \
19-
curl \
2019
fontconfig \
2120
memcached \
22-
netcat-openbsd \
2321
php8-ctype \
2422
php8-curl \
2523
php8-dom \

Dockerfile.armhf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ RUN \
1616
composer && \
1717
echo "**** install runtime packages ****" && \
1818
apk add --no-cache \
19-
curl \
2019
fontconfig \
2120
memcached \
22-
netcat-openbsd \
2321
php8-ctype \
2422
php8-curl \
2523
php8-dom \

root/etc/cont-init.d/50-config

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ done
3636

3737
# Echo init finish for test runs
3838
if [ -n "${TEST_RUN}" ]; then
39-
echo '[services.d] done.'
39+
echo '[ls.io-init] done.'
4040
fi
4141

4242
# Create API key if needed
@@ -121,24 +121,22 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
121121
echo 'post_max_size = 100M' >>/config/php/php-local.ini
122122
fi
123123

124-
# check for the mysql endpoint for 30 seconds
125-
END=$((SECONDS + 30))
126-
while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST}" ]; do
127-
if /usr/bin/nc -z "${DB_HOST}" "${DB_PORT}"; then
128-
if [ -n "$(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}")" ]; then
129-
if [ -n "${RUN}" ]; then
130-
break
131-
fi
132-
RUN="RAN"
133-
# we sleep here again due to first run init on DB containers
134-
if [ ! -f /dbwait.lock ]; then
135-
sleep 5
136-
fi
137-
else
138-
sleep 1
124+
# check for the mysql endpoint
125+
echo "Waiting for DB to be available"
126+
END=$((SECONDS+30))
127+
while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
128+
if [[ $(/usr/bin/nc -w1 "${DB_HOST}" "${DB_PORT}" | tr -d '\0') ]]; then
129+
if [[ -n "${RUN}" ]]; then
130+
break
139131
fi
132+
RUN="RAN"
133+
# we sleep here again due to first run init on DB containers
134+
if [[ ! -f /dbwait.lock ]]; then
135+
sleep 5
136+
fi
137+
else
138+
sleep 1
140139
fi
141-
sleep 1
142140
done
143141

144142
# update database - will set up database if fresh, or, migrate existing

0 commit comments

Comments
 (0)