Re: archive_command debugging

From: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
To: Nick Renders <postgres(at)arcict(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: archive_command debugging
Date: 2023-08-23 16:03:23
Message-ID: ZOYty0Mtkx2ZqX-d@elch.exwg.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

## Nick Renders (postgres(at)arcict(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hellen Jiang 2023-08-23 16:42:06 Read only user permission
Previous Message Nick Renders 2023-08-23 15:07:01 archive_command debugging