Re: archive_commnad parameter question

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: archive_commnad parameter question
Date: 2021-04-19 21:18:45
Message-ID: 20210419211845.GA31797@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alan Hodgson 2021-04-19 21:19:38 Re: archive_commnad parameter question
Previous Message Gavan Schneider 2021-04-19 21:16:56 Re: archive_commnad parameter question

Browse pgsql-hackers by date

  From Date Subject
Next Message Alan Hodgson 2021-04-19 21:19:38 Re: archive_commnad parameter question
Previous Message Gavan Schneider 2021-04-19 21:16:56 Re: archive_commnad parameter question