summaryrefslogtreecommitdiffstats
path: root/docker/filebin_starter.sh
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-07-10 10:30:31 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-10 10:30:31 +0200
commit6b7cce63effcfd247f21a1324a81c38118cdd58a (patch)
tree2b9b82824f3c89bd9bf0c277d772ce8112a12cb1 /docker/filebin_starter.sh
parent3a865d90a6dc1493c06ab5cb500d63836b7c8c9b (diff)
docker: Wait for database to reachable before doing anything
This is necessary for future use of docker-compose Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'docker/filebin_starter.sh')
-rwxr-xr-xdocker/filebin_starter.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/docker/filebin_starter.sh b/docker/filebin_starter.sh
index 65cf4a44b..4fa50d583 100755
--- a/docker/filebin_starter.sh
+++ b/docker/filebin_starter.sh
@@ -12,6 +12,13 @@ function set_database_config() {
sed -i "s/\$db\['default'\]\['database'\] = .*/\$db['default']['database'] = \"${FB_DB_DATABASE}\";/" ${FILEBIN_DIR}/application/config/database.php
}
+# wait for DB to be ready
+while ! nc "$FB_DB_HOSTNAME" 3306 </dev/null >/dev/null; do
+ echo "Waiting for database"
+ sleep 0.5
+done
+
+
if [[ ! -e $FILEBIN_DIR/application/config/config-local.php ]]; then
echo "no config found, new config will be generated"
cp $FILEBIN_DIR/application/config/example/config-local.php ${FILEBIN_DIR}/application/config/config-local.php