Re: archive_command fails but works outside of Postgres

From: Scott Mead <scottm(at)openscg(dot)com>
To: twoflower <standa(dot)kurik(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: archive_command fails but works outside of Postgres
Date: 2017-08-19 10:50:52
Message-ID: BF0C86B3-6677-4720-B1D7-47D567242EB5@openscg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Aug 19, 2017, at 04:05, twoflower <standa(dot)kurik(at)gmail(dot)com> wrote:
>
> Alvaro Herrera-9 wrote
> I saw one installation with "gsutil cp" in archive_command recently. It had the CLOUDSDK_PYTHON environment variable set in the archive_command itself. Maybe that's a problem.
> After all, this was the solution:
> archive_command = 'CLOUDSDK_PYTHON=/usr/bin/python gsutil cp /storage/postgresql/9.6/main/pg_xlog/%p gs://my_bucket/'
> as also hinted in https://github.com/GoogleCloudPlatform/gsutil/issues/402
>
> I still don't understand why the environments differ (the context of archive_command vs. "su postgres -" and executing it there) but I am happy it's working now. Thank you!

If postgres is running under systemd, you'll have a wildly different environment than if you just su to postgres.

--Scott

> View this message in context: Re: archive_command fails but works outside of Postgres
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2017-08-19 16:51:08 Re: Results interpretation
Previous Message twoflower 2017-08-19 08:05:23 Re: archive_command fails but works outside of Postgres