Skip to content
Snippets Groups Projects
Verified Commit 26808056 authored by Evangelos Foutras's avatar Evangelos Foutras :smiley_cat:
Browse files

borg_client: stop ignoring errors during db dumps

Due to the "systemctl is-active foo && backup-foo || true" shorthand,
errors during database dumping were being ignored. Change the MariaDB
section to also be wrapped in a proper if statement. Finally, get rid
of "|| true" silencing statements + enable errexit in helper scripts.
parent 4519d2e3
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
set -e
mysql_opts="--defaults-file={{mysql_backup_defaults}}"
backupdir="{{mysql_backup_dir}}"
......
......@@ -3,7 +3,8 @@
# Script to backup all postgres databases individually
#
# Requires local login with `postgres` user and either trusted or peer auth.
#
set -e
DBLIST=($(sudo -u postgres psql -d postgres -qt -c 'SELECT datname from pg_database'))
for db in "${DBLIST[@]}"; do
......
......@@ -40,9 +40,11 @@ cleanup() {
trap cleanup EXIT
# Dump databases to /root/backup-{postgres,mysql} before taking a btrfs snapshot
systemctl is-active postgresql && /usr/local/bin/backup-postgres.sh || true
if systemctl is-active mysqld || systemctl is-active mariadb; then
/usr/local/bin/backup-mysql.sh || true
if systemctl is-active postgresql; then
/usr/local/bin/backup-postgres.sh
fi
if systemctl is-active mariadb; then
/usr/local/bin/backup-mysql.sh
fi
if is_btrfs "$src"; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment