Re: Looking for a script that performs full online backup of postgres in archive mode

Поиск
Список
Период
Сортировка
Искать
От
Jukka Inkeri
Тема
Re: Looking for a script that performs full online backup of postgres in archive mode
Дата
Msg-id
ef52c43579e3ce23f58aa579e92bc9fcbc00d2d2@localhost
Список
Дерево обсуждения
Looking for a script that performs full online backup of postgres in archive mode Chris Barnes <compuguruchrisbarnes@hotmail.com>
Re: Looking for a script that performs full online backup of postgres in archive mode Mark Styles <postgres@lambic.co.uk>
Re: Looking for a script that performs full online backup of postgres in archive mode Chris Barnes <compuguruchrisbarnes@hotmail.com>
Re: Looking for a script that performs full online backup of postgres in archive mode Sam Mason <sam@samason.me.uk>
 > have a shell script that
> performs a full online backup of postgres?

Full backup ex. pg_dumpall

Daily backup (dump) / database:
- - - - - - - - - - - - - - -
#!/someshellpath like /bin/sh or /bin/bash or /bin/ksh ...
#daily.sh
#default plaintext
#usage: daily.sh [c|t|p]
#
PORT=5432
HOST="localhost"
DB="mysomedb"
DB_USER="myusername"
FORMAT="p"  # c t p=plaintext
TYPE="txt"
COMPRESS=1
case "$1" in
         c) FORMAT="c"; COMPRESS=0;;
         t) FORMAT="t";;
         p) FORMAT="p";;
esac
case "$FORMAT" in
         c) TYPE=comp ;;
         t) TYPE=tar ;;
         p) TYPE="txt" ;;
esac
day=$(date '+%d');

pg_dump -F "$FORMAT" -p "$PORT" -h "$HOST"  -U "$DB_USER"  "$DB" > 
daily.$day.backup.$TYPE
[ "$COMPRESS" = 0 ] && exit 0

# compress daily.$day.backup.$TYPE
gzip daily.$day.backup.$TYPE

- - - - - - - - - - - - - - -
Remember - test also your restore procedure.

В списке pgsql-general по дате отправления
От: Jan Otto
Дата:
От: Albe Laurenz
Дата:
FAQ