pg_start/stop_backup non-exclusive scripts to snapshot

From: hvjunk <hvjunk(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_start/stop_backup non-exclusive scripts to snapshot
Date: 2017-07-04 16:41:19
Message-ID: E8A5F096-3D0F-41D5-8356-81C9FB3C3EE7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

I’ve previously done ZFS snapshot backups like this:

psql -c “select pg_start_backup(‘snapshot’);”
zfs snapshot TANK/postgresql(at)`date ‘+%Ymd’`
psql -c “select * from pg_stop_backup();”

Reading the PostgreSQL9.6 documentation, the advice/future is to use the non-exclusive method, where I’ll need to keep a session *open* while the snapshot takes place, and after that I’ll have to issue the pg_stop_backup(false); in that active connection that issued the pg_start_backup(‘backup’,false,false);

How is this done inside a shell script?
Especially how to do error checking from the commands as psql -c “select pg_start_backup{‘test’,false,false);” not going to work?

Hendrik

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2017-07-04 16:55:08 Re: Invalid field size
Previous Message Adrian Klaver 2017-07-04 16:25:04 Re: [SPAM] Re: Invalid field size