Re: pg_archivecleanup standalone bash script

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pg_archivecleanup standalone bash script
Date: 2016-08-01 00:26:38
Message-ID: CAKFQuwZ+Xo5M-N6zUGWvBU00R0BpTCvhfra5nQrXg0Uj=OfHsA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jul 31, 2016 at 6:11 PM, Patrick B <patrickbakerbr(at)gmail(dot)com> wrote:

>
> CHKPOINT=$(find $ARCHIVEDIR -type f -mtime +30 -name '00*' -printf '%f\n'
> | sort -r | head -1)
>
> /usr/pgsql-${PG_VERSION}/bin/pg_archivecleanup $ARCHIVEDIR $CHKPOINT
>
>
>
​While I'm a bit suspect of this entire script/approach I believe the
problem plaguing you at the moment is that your find command is not finding
any files and thus your attempt to execute pg_archivecleanup only occurs
with a single argument - which is an error.

For something this important I would advise considerably more debugging
output and explicit error handling. Don't rely on set -e

On a related note - I don't understand why you'd use the "exec" command
here...

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick B 2016-08-01 00:54:35 Re: pg_archivecleanup standalone bash script
Previous Message rob stone 2016-07-31 23:28:57 Re: 9.6beta3