From: Pyrote <pyromania@guungle.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Initiate backup from routine?
Date: Wed, 17 Jan 2024 10:15:41 -0600
Message-ID: <cc0488b7ba69bcebd75391cb1615c11b@guungle.com> (raw)
On Wednesday, January 17, 2024, Troels Arvin <troels@arvin.dk> wrote:
> Is it possible to call pg_dump (or equivalent action) through a
> procedure/function?
You could create a new schema and table that holds a flag column or a
simple queue.
Then setup a script/app on a 5 minute cron that checks the status of the
flag or queue to see if it needs to start a backup.
The script/app could update the table to show the user that the backup
has started and when its finished.
The user account on the DB server that runs the code would have their
shell set to /bin/false so they cannot login. The DB account used by the
code would have the minimum privileges to perform the backup.
Or if it needs to be more real-time, the app could use LISTEN/NOTIFY to
trigger the backup process. Then use cron on some interval to make sure
the app is always running.
Then you just need the procedure to update the flag/queue or send a
NOTIFY message.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: pyromania@guungle.com
Subject: Re: Initiate backup from routine?
In-Reply-To: <cc0488b7ba69bcebd75391cb1615c11b@guungle.com>
References: <cc0488b7ba69bcebd75391cb1615c11b@guungle.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox