Re: [GENERAL] archive_command fails but works outside of Postgres - Mailing list pgsql-general

From Scott Marlowe
Subject Re: [GENERAL] archive_command fails but works outside of Postgres
Date
Msg-id CAOR=d=1Fve4AORMfHA-+JkO4AAQ1czTH9J13VEBRuOfUwDOtwQ@mail.gmail.com
Whole thread Raw
In response to [GENERAL] archive_command fails but works outside of Postgres  (twoflower <standa.kurik@gmail.com>)
Responses Re: [GENERAL] archive_command fails but works outside of Postgres  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: [GENERAL] archive_command fails but works outside of Postgres  (twoflower <standa.kurik@gmail.com>)
List pgsql-general
On Fri, Aug 18, 2017 at 12:40 PM, twoflower <standa.kurik@gmail.com> wrote:
> I changed my archive_command to the following:
>
> archive_command = 'gsutil cp /storage/postgresql/9.6/main/%p
> gs://my_bucket/pg_xlog/'
>
> and it fails, leaving the following in the log:
>
> 2017-08-18 18:34:25.057 GMT [1436][0]: [104319] LOG:  archive command failed
> with exit code 1
> 2017-08-18 18:34:25.057 GMT [1436][0]: [104320] DETAIL:  The failed archive
> command was: gsutil cp
> /storage/postgresql/9.6/main/000000010000038B000000D8
> gs://my_bucket/pg_xlog/
> 2017-08-18 18:34:25.057 GMT [1436][0]: [104321] WARNING:  archiving
> transaction log file "000000010000038B000000D8" failed too many times, will
> try again later
>
>
> But the command works when executed manually:
>
> root$ su postgres -c "gsutil cp
> /storage/postgresql/9.6/main/000000010000038B000000D8
> gs://my_bucket/pg_xlog/"
> root$ echo $?
> 0
>
> The last command verifies that gsutil indeed exited with 0.
>
> How to best debug this issue?

Sounds like it depends on some envvar it doesn't see when run from the
postmaster. If you sudo -u postgres and run it does it work?


pgsql-general by date:

Previous
From: Igor Korot
Date:
Subject: Re: [GENERAL] Results interpretation
Next
From: Alvaro Herrera
Date:
Subject: Re: [GENERAL] archive_command fails but works outside of Postgres