Automatic restore of backups when /data is empty

This commit is contained in:
Tim Möhlmann
2018-11-30 16:59:03 +02:00
parent de3f125ed3
commit 3ce73f5bc0
3 changed files with 22 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ dest="/backup/base-$(date +%F-%H%M)"
last=$(ls -d /backup/base* | tail -n1)
mkdir $dest || exit $?
pg_basebackup --pgdata=$dest --format=tar --gzip --username=postgres || exit $?
pg_basebackup --wal-method=none --pgdata=$dest --format=tar --gzip --username=postgres || exit $?
# Clean old base backups, keep the last and the current.
for d in /backup/base*; do