scripts/pgbackup
author Tomas Zeman <tomas@functionals.cz>
Mon, 27 Apr 2020 22:24:49 +0200
changeset 59 a3e588dcdcb3
parent 23 5eaf174f21fa
permissions -rw-r--r--
vimb config/dark style (based on https://fanglingsu.github.io/vimb/howto.html)

#!/bin/sh -e
# Creates full pgsql backup with symlinks to last and prev backup.

BACKUPDIR=/home/pgsql/backup
N=pg_dumpall-`date +%F`.bz2
F=$BACKUPDIR/$N

pg_dumpall | bzip2 > $F.tmp
mv $F.tmp $F
cd $BACKUPDIR
[ -L last ] && mv last prev
ln -sf $N last