ptut-virtenv/metactl/post-start.sh

20 lines
728 B
Bash
Raw Normal View History

#!/bin/bash
source $(dirname `realpath $0`)/environment.sh;
#############################################
## ##
## Executed after launching containers ##
## ##
#############################################
# 1.1. Restore mariadb database
cat $ROOT/persistent/mariadb.sql | docker exec -i $MARIADB_SERVICE mysql -uroot -p$MARIADB_ROOT_PASSWORD $MARIADB_DATABASE_NAME 2>/dev/null;
DB_RESTORED="$?";
# 1.2. Try until connection OK
while [ "$DB_RESTORED" != "0" ]; do
sleep 1;
cat $ROOT/persistent/mariadb.sql | docker exec -i $MARIADB_SERVICE mysql -uroot -p$MARIADB_ROOT_PASSWORD $MARIADB_DATABASE_NAME 2>/dev/null;
DB_RESTORED="$?";
done;