From 238dbfbe67bfca6e553f6358dc79555c1decdd8e Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Tue, 22 Aug 2023 09:15:31 +0200 Subject: [PATCH] changed to mariadb commands --- restic/files/backup.sh.jinja | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restic/files/backup.sh.jinja b/restic/files/backup.sh.jinja index 3d3232a..40eba42 100644 --- a/restic/files/backup.sh.jinja +++ b/restic/files/backup.sh.jinja @@ -3,13 +3,13 @@ {%- if pillar['pods']['mariadb'] is defined %} umask 0077 BACKUP_DIR={{ pillar.pods.mariadb.containers.main.backup_dir }} -databases=$(podman exec -it mariadb-main mysql -B -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} -e "SHOW DATABASES;" | tr -d "| " | grep -v Database) +databases=$(podman exec -it mariadb-main mariadb -B -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} -e "SHOW DATABASES;" | tr -d "| " | grep -v Database) for db in ${databases[@]}; do db=${db::-1} if [[ "$db" != "information_schema" ]] && [[ "$db" != "performance_schema" ]] && [[ "$db" != "mysql" ]] && [[ "$db" != _* ]] && [[ "$db" != "sys" ]]; then echo "Dumping database: $db" - podman exec -it mariadb-main mysqldump -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} --databases $db | gzip > ${BACKUP_DIR}/$(date +"%Y-%m-%d_%H-%M-%S")_$db-sql.gz + podman exec -it mariadb-main mariadb-dump -u root -p{{ pillar.pods.mariadb.containers.main.env.MYSQL_ROOT_PASSWORD }} --databases $db | gzip > ${BACKUP_DIR}/$(date +"%Y-%m-%d_%H-%M-%S")_$db-sql.gz fi done # Delete the files older than 3 days