archive_command was added in PostgreSQL 8.0.
Disabling WAL archiving
archive_mode requires a PostgreSQL restart for changes to become effective, the recommended method of temporarily disabling WAL archiving is to set
archive_command to an empty string (
''), which will cause the command to fail. Archiving will resume onece a valid
archive_command is set.
archive_command is set to an arbitrary command which returns a zero exit status (success), e.g.
/bin/true, WAL files ready for archiving will be removed without being archived. This also effectively disables archiving, but means there will be a break in the chain of archived WAL files, and unless the files are archived by another route, the archive will only be valid up until the last file archived before the archiving chain was broken.
Precise details of the failure can be found in the PostgreSQL log file and will look something like this:
[2019-06-10 21:51:43 UTC] node2 postgres [unknown] LOCATION: ProcessStandbyReplyMessage, walsender.c:1788 cp: cannot create regular file "/home/backup/invalid-wal-dir/000000010000000000000001": No such file or directory [2019-06-10 21:51:44 UTC] LOG: 00000: archive command failed with exit code 1 [2019-06-10 21:51:44 UTC] DETAIL: The failed archive command was: test ! -f /home/backup/invalid-wal-dir/000000010000000000000001 && cp pg_wal/000000010000000000000001 /home/backup/invalid-wal-dir/000000010000000000000001