Allow backups from root

This commit is contained in:
Micke Nordin 2024-12-11 16:22:09 +01:00
parent 2c61a00ebd
commit 62d172b2f5
Signed by untrusted user: Micke
GPG key ID: 0DA0A7A5708FE257

View file

@ -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