Skip site navigation (1) Skip section navigation (2)

Re: somewhat wrong archive_command example

From: Euler Taveira de Oliveira <euler(at)timbira(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Greg Smith <greg(at)2ndquadrant(dot)com>, pgsql-docs(at)postgresql(dot)org
Subject: Re: somewhat wrong archive_command example
Date: 2011-09-22 18:41:31
Message-ID: 4E7B815B.7080500@timbira.com (view raw or flat)
Thread:
Lists: pgsql-docs
On 22-09-2011 15:15, Josh Kupershmidt wrote:
> Few more suggestions/nitpicks:
>   1.) IMO it's more logical to put the test for whether the $ARCHIVE
> directory exists before the test whether ${ARCHIVE}/${FILE} exists.
No. If you do so, it will end up wasting a lot of cpu cycles testing something 
that is *always* true (if the directory exists). AFAICS this test is to handle 
a cp failure case nicely.

>   2.) I think the error code reporting here is not sound:
>
> cp ${FULLPATH} ${ARCHIVE}/${FILE}
> if [ $? -ne 0 ] ; then
>    echo $0 Archive copy of ${FILE} failed with error $?>&2
>
> at least on my OS X machine, that echo produces a message like
> "./local_backup_script.sh Archive copy of failed with error 0", I
> guess since $? gets reset to 0 after that if-statement. You can use a
> temporary variable like $ERRCODE=$? to get around this.
>
Right.


-- 
    Euler Taveira de Oliveira - Timbira       http://www.timbira.com.br/
    PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

In response to

Responses

pgsql-docs by date

Next:From: Josh KupershmidtDate: 2011-09-22 19:29:25
Subject: Re: somewhat wrong archive_command example
Previous:From: Josh KupershmidtDate: 2011-09-22 18:15:30
Subject: Re: somewhat wrong archive_command example

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group