diff --git a/roles/common/templates/backup_mysql_database.sh b/roles/common/templates/backup_mysql_database.sh index 92ec378..dd9ebef 100644 --- a/roles/common/templates/backup_mysql_database.sh +++ b/roles/common/templates/backup_mysql_database.sh @@ -2,9 +2,14 @@ set -euxo pipefail; -file={{ backups_mysql_database_directory | quote }}"/$1.sql.gpg"; +# Arguments +db="$1"; -mysqldump --opt --databases "$1" | +# Variables +file={{ backups_mysql_database_directory | quote }}"/$db.sql.gpg"; + +# Execution +mysqldump --opt --databases "$db" | pv --quiet --buffer-size 256M | gpg --quiet --no-verbose --encrypt --recipient {{ backup_gpg_fingerprint | quote }} --trust-model always > "$file"; chmod u+r-wx,g+r-wx,o+r-wx "$file";