19 lines
677 B
Bash
19 lines
677 B
Bash
#!/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 -uroot -p$MARIADB_ROOT_PASSWORD $MARIADB_DATABASE_NAME > $ROOT/persistent/mariadb.sql;
|
|
test "$?" = "0" && echo "done" || (echo "failed"; exit 1); |