From 62d172b2f5bcc933596abd1b32c770bccb932cd8 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Wed, 11 Dec 2024 16:22:09 +0100 Subject: [PATCH] Allow backups from root --- templates/mariadb_backup/do_backup.erb.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/mariadb_backup/do_backup.erb.sh b/templates/mariadb_backup/do_backup.erb.sh index 9ba16b5..b606fd1 100644 --- a/templates/mariadb_backup/do_backup.erb.sh +++ b/templates/mariadb_backup/do_backup.erb.sh @@ -8,10 +8,12 @@ mkdir -p "${backup_dir}" if [[ -z ${customer} ]]; then buopts="--slave-info --safe-slave-backup" dumpopts="--dump-slave" - mysql -p${MYSQL_ROOT_PASSWORD} -e "stop slave" + mysql -p"${MYSQL_ROOT_PASSWORD}" -u root -e "stop slave" fi -mariadb-backup --backup ${buopts} -u root -p${MYSQL_ROOT_PASSWORD} --stream=xbstream | gzip >"${backup_dir}/${stream_name}" -mysqldump --all-databases --single-transaction ${dumpopts} -u root -p${MYSQL_ROOT_PASSWORD} | gzip >"${backup_dir}/${dump_name}" +# shellcheck disable=SC2086 +mariadb-backup --backup ${buopts} -u root -p"${MYSQL_ROOT_PASSWORD}" --stream=xbstream | gzip >"${backup_dir}/${stream_name}" +# shellcheck disable=SC2086 +mysqldump --all-databases --single-transaction ${dumpopts} -u root -p"${MYSQL_ROOT_PASSWORD}" | gzip >"${backup_dir}/${dump_name}" if [[ -z ${customer} ]]; then - mysql -p${MYSQL_ROOT_PASSWORD} -e "start slave" + mysql -p"${MYSQL_ROOT_PASSWORD}" -u root -e "start slave" fi