pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: Nick Renders <postgres@arcict.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: archive_command debugging
Date: Wed, 23 Aug 2023 18:03:23 +0200
Message-ID: <ZOYty0Mtkx2ZqX-d@elch.exwg.net> (raw)
In-Reply-To: <8668FD1A-3696-4B43-BC23-7D38FE9064F0@arcict.com>
References: <8668FD1A-3696-4B43-BC23-7D38FE9064F0@arcict.com>

## Nick Renders (postgres@arcict.com):

> I was wondering if anyone had any good tips for "debugging" the
> archive_command in the postgresql.conf.

For starters, you get rather noisy logging when that command fails
(plus all the output from the command itself), so check your postgres
logfile first. Also, you get some additional debug logging at level
DEBUG3.
Then archive_command basically inherits it's environment and user id
from the archiver process, so you could check that process' proc entries.
Third, archive_command is executed via system() (after template
processing), so you're free to do... quite a lot in there (just
don't mess with the exit status). It might be more convenient to
use some shell wrapper around your final archive command and have
that wrapper do all the logging etc. you might want.

And a final tip: do not rely on the environment, always use full
paths, and if you ever might have whitespace or other "funny
characters" in some path/file name (or always, just to be safe)
make sure you get your quoting right.

Regasrds,
Christoph

-- 
Spare Space





view thread (2+ messages)

Message-ID: <ZOYty0Mtkx2ZqX-d@elch.exwg.net>
Permalink:  ../ZOYty0Mtkx2ZqX-d@elch.exwg.net/
Also on:    postgresql.org/message-id/ZOYty0Mtkx2ZqX-d@elch.exwg.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: cmt@burggraben.net, postgres@arcict.com
  Subject: Re: archive_command debugging
  In-Reply-To: <ZOYty0Mtkx2ZqX-d@elch.exwg.net>
  References: <8668FD1A-3696-4B43-BC23-7D38FE9064F0@arcict.com> <ZOYty0Mtkx2ZqX-d@elch.exwg.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox