File tree Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Expand file tree Collapse file tree 1 file changed +13
-20
lines changed Original file line number Diff line number Diff line change 35
35
fi
36
36
done
37
37
38
- # Echo init finish for test runs
39
- if [ -n "${TEST_RUN}" ]; then
40
- echo '[services.d] done.'
41
- fi
42
-
43
38
# Create API key if needed
44
39
if [ ! -f "/config/BOOKSTACK_APP_KEY.txt" ];
45
40
then
@@ -95,24 +90,22 @@ if ! grep -qx '^post_max_size.*$' /config/php/php-local.ini; then
95
90
echo 'post_max_size = 100M' >> /config/php/php-local.ini
96
91
fi
97
92
98
- # check for the mysql endpoint for 30 seconds
93
+ # check for the mysql endpoint
94
+ echo "Waiting for DB to be available"
99
95
END=$((SECONDS+30))
100
- while [ ${SECONDS} -lt ${END} ] && [ -n "${DB_HOST+x}" ]; do
101
- if /usr/bin/nc -z ${DB_HOST} 3306; then
102
- if [ ! -z "$(/usr/bin/nc -w1 ${DB_HOST} 3306)" ]; then
103
- if [ ! -z "${RUN}" ]; then
104
- break
105
- fi
106
- RUN="RAN"
107
- # we sleep here again due to first run init on DB containers
108
- if [ ! -f /dbwait.lock ]; then
109
- sleep 5
110
- fi
111
- else
112
- sleep 1
96
+ while [[ ${SECONDS} -lt ${END} ]] && [[ -n "${DB_HOST+x}" ]]; do
97
+ if [[ $(/usr/bin/nc -w1 "${DB_HOST}" 3306 | tr -d '\0') ]]; then
98
+ if [[ -n "${RUN}" ]]; then
99
+ break
100
+ fi
101
+ RUN="RAN"
102
+ # we sleep here again due to first run init on DB containers
103
+ if [[ ! -f /dbwait.lock ]]; then
104
+ sleep 5
113
105
fi
106
+ else
107
+ sleep 1
114
108
fi
115
- sleep 1
116
109
done
117
110
118
111
# update database - will set up database if fresh, or, migrate existing
You can’t perform that action at this time.
0 commit comments