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.
|_|_) | |
| | | [email protected] | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
signature.asc
Description: PGP signature
