Re: archive_commnad parameter question - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: archive_commnad parameter question
Date
Msg-id 20210419211845.GA31797@hjp.at
Whole thread Raw
In response to archive_commnad parameter question  (Allie Crawford <CrawfordMA@ChurchofJesusChrist.org>)
List pgsql-general
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!"

Attachment

pgsql-general by date:

Previous
From: Gavan Schneider
Date:
Subject: Re: archive_commnad parameter question
Next
From: Alan Hodgson
Date:
Subject: Re: archive_commnad parameter question