More quiet

This commit is contained in:
Benoit S 2021-02-01 20:05:35 +09:00
parent 8929625c95
commit 8ee456df74

View file

@ -3,14 +3,14 @@ set -euo pipefail
cd /var/backups/databases cd /var/backups/databases
for i in $(lxc list --format csv -c n); do for i in $(lxc list --format csv -c n); do
if lxc exec "$i" -- which mysql>/dev/null; then if lxc exec "$i" -- which mysql >/dev/null 2>&1; then
echo "Dumping $i" echo "Dumping $i"
lxc exec "$i" -- mysqldump --opt --all-databases --force --events --hex-blob | cat > "${i}.sql" lxc exec "$i" -- mysqldump --opt --all-databases --force --events --hex-blob | cat > "${i}.sql"
fi fi
if lxc exec "$i" -- which psql >/dev/null; then if lxc exec "$i" -- which psql >/dev/null 2>&1; then
if lxc exec "$i" -- id postgres >/dev/null 2>&1; then if lxc exec "$i" -- id postgres >/dev/null 2>&1; then
echo "Dumping $i" echo "Dumping $i"
lxc exec "$i" -- sudo -u postgres pg_dumpall | cat > "${i}.sql" lxc exec "$i" -- sudo -u postgres pg_dumpall 2>/dev/null | cat > "${i}.sql"
fi fi
fi fi
done done