hopefully fix bad backups

master
Bel LaPointe 2020-12-06 20:04:35 -07:00
parent 9182e656bf
commit b2cfba373e
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,10 @@
b=$(date +%Y%m%d%H%M%S)
mkdir -p /mnt/save/$b
pg_dump $DATABASE_URL --clean > /mnt/save/$b/pg.dump \
(
set -e
pg_dump $DATABASE_URL --clean > /mnt/save/$b/.pg.dump
mv /mnt/save/$b/{.,""}pg.dump
) \
|| (
rm -rf /mnt/save/$b
echo "backup failed; deleting $b"