Update docker.yml
This commit is contained in:
parent
18e3467d88
commit
3d6c3dd163
11
docker.yml
11
docker.yml
@ -166,10 +166,15 @@
|
||||
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)
|
||||
# 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
|
||||
docker exec -ti $i /usr/bin/test -x /usr/bin/mariadb-dump && DBDUMPCMD=/usr/bin/mariadb-dump
|
||||
docker exec -ti $i /usr/bin/test -x /usr/bin/mysqldump && DBDUMPCMD=/usr/bin/mysqldump
|
||||
if [ -z "$DBDUMPCMD" ]
|
||||
then
|
||||
g_echo_error "No dbdumpcmd found in container $i! No backup created!"
|
||||
continue
|
||||
fi
|
||||
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 $DBDUMPCMD --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!
|
||||
OLD_BACKUPS=$(ls -1 $BACKUPDIR/$i*.gz |wc -l)
|
||||
if [ $OLD_BACKUPS -gt $DAYS ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user