Update docker.yml
This commit is contained in:
parent
96a6650f00
commit
85971228b9
@ -161,9 +161,13 @@
|
|||||||
mkdir -p $BACKUPDIR
|
mkdir -p $BACKUPDIR
|
||||||
for i in $CONTAINER
|
for i in $CONTAINER
|
||||||
do
|
do
|
||||||
|
# get credentials
|
||||||
MARIADB_DATABASE=$(docker exec $i env | egrep "MARIADB_DATABASE|MYSQL_DATABASE" | tail -n1 |cut -d"=" -f2)
|
MARIADB_DATABASE=$(docker exec $i env | egrep "MARIADB_DATABASE|MYSQL_DATABASE" | tail -n1 |cut -d"=" -f2)
|
||||||
MARIADB_PWD=$(docker exec $i env | egrep "MARIADB_PASSWORD|MYSQL_PASSWORD" | tail -n1 |cut -d"=" -f2)
|
MARIADB_PWD=$(docker exec $i env | egrep "MARIADB_PASSWORD|MYSQL_PASSWORD" | tail -n1 |cut -d"=" -f2)
|
||||||
MARIADB_USR=$(docker exec $i env | egrep "MARIADB_USER|MYSQL_USER" | tail -n1 |cut -d"=" -f2)
|
MARIADB_USR=$(docker exec $i env | egrep "MARIADB_USER|MYSQL_USER" | tail -n1 |cut -d"=" -f2)
|
||||||
|
# get dump path
|
||||||
|
docker compose exec -ti $i /usr/bin/test -x /usr/bin/mariadb-dump && DBDUMPCMD=/usr/bin/mariadb-dump
|
||||||
|
docker compose exec -ti $i /usr/bin/test -x /usr/bin/mysqldump && DBDUMPCMD=/usr/bin/mysqldump
|
||||||
g_echo "Sichere Datenbank $MARIADB_DATABASE DB aus $i";
|
g_echo "Sichere Datenbank $MARIADB_DATABASE DB aus $i";
|
||||||
docker exec $i /usr/bin/mysqldump --no-tablespaces -u $MARIADB_USR -p$MARIADB_PWD $MARIADB_DATABASE 2>${g_tmp}/dberr | gzip > $BACKUPDIR/$i-$MARIADB_DATABASE-$TIMESTAMP.sql.gz || g_echo_error "DB-Backup von $MARIADB_DATABASE war nicht erfolgreich $(cat ${g_tmp}/dberr)"
|
docker exec $i /usr/bin/mysqldump --no-tablespaces -u $MARIADB_USR -p$MARIADB_PWD $MARIADB_DATABASE 2>${g_tmp}/dberr | gzip > $BACKUPDIR/$i-$MARIADB_DATABASE-$TIMESTAMP.sql.gz || g_echo_error "DB-Backup von $MARIADB_DATABASE war nicht erfolgreich $(cat ${g_tmp}/dberr)"
|
||||||
# dont delete last old backups!
|
# dont delete last old backups!
|
||||||
|
Loading…
Reference in New Issue
Block a user