19 lines
662 B
Bash
19 lines
662 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 > $MARIADB_DUMP;
|
|
test "$?" = "0" && echo "done" || (echo "failed"; exit 1); |