From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: archive_commnad parameter question
Date: Mon, 19 Apr 2021 23:18:45 +0200
Message-ID: <20210419211845.GA31797@hjp.at> (raw)
In-Reply-To: <CY4PR04MB04704227BFE53F5C5E799748D9499@CY4PR04MB0470.namprd04.prod.outlook.com>
References: <CY4PR04MB04704227BFE53F5C5E799748D9499@CY4PR04MB0470.namprd04.prod.outlook.com>
On 2021-04-19 21:09:13 +0000, Allie Crawford wrote:
> I am new in PostgreSQL and I am trying to understand what the “test” word is
> representing in the archive_command configuration that the PostgreSQL
> documentation is showing as the format on how to set up this parameter
>
> archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/
> archivedir/%f' # Unix
>
> Does anybody know what is “test” representing in this parameter configuration?
"test" is a unix command for testing stuff (as the name implies).
"test -f" in particular tests whether the argument exists and is a
regular file) and the "!" inverts the result.
So the whole line checks that the target *doesn't* already exist before
attempting to copy over it.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: hjp-pgsql@hjp.at
Subject: Re: archive_commnad parameter question
In-Reply-To: <20210419211845.GA31797@hjp.at>
References: <CY4PR04MB04704227BFE53F5C5E799748D9499@CY4PR04MB0470.namprd04.prod.outlook.com> <20210419211845.GA31797@hjp.at>
* 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