ptut-virtenv/metactl/pre-stop.sh

19 lines
673 B
Bash
Raw Normal View History

#!/bin/bash
source $(dirname `realpath $0`)/environment.sh;
#############################################
## ##
## Executed before stopping containers ##
## ##
#############################################
## [1] Backup mariadb database
# 1. Create parent dir (if does not exists)
test ! -d $ROOT/persistent && mkdir -p $ROOT/persistent;
# 2. Backup database
echo -ne " * Backup database...........";
docker exec $MARIADB_SERVICE mysqldump --all-databases --flush-privileges -uroot -p$MARIADB_ROOT_PASSWORD > $MARIADB_DUMP;
test "$?" = "0" && echo "done" || (echo "failed"; exit 1);