public inbox for [email protected]  
help / color / mirror / Atom feed
From: Josh Kupershmidt <[email protected]>
To: Greg Smith <[email protected]>
To: Euler Taveira de Oliveira <[email protected]>
Cc: [email protected]
Subject: Re: somewhat wrong archive_command example
Date: Thu, 22 Sep 2011 14:15:30 -0400
Message-ID: <CAK3UJRHChOcGQ0kzu01wZX6PB9pScHSzg1X+hThdR7QXWoe1yw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>
	<[email protected]>

On Wed, Sep 21, 2011 at 8:59 PM, Euler Taveira de Oliveira
<[email protected]> wrote:
> On 21-09-2011 20:02, Greg Smith wrote:
>>
>> Attached version fixes the late night brain fade errors. I think the right
>> thing to do next is to package this up into a doc update that corrects the
>> errors in that section too; just clean the whole thing up while I'm poking
>> at
>> it. I'll submit that over to the hackers list so that everyone can take a
>> shot
>> at correcting my shell code.

First, a +1 on the impetus for this script.

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.
 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.

Josh



view thread (24+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: somewhat wrong archive_command example
  In-Reply-To: <CAK3UJRHChOcGQ0kzu01wZX6PB9pScHSzg1X+hThdR7QXWoe1yw@mail.gmail.com>

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

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