Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 79193B5DC3E for ; Thu, 22 Sep 2011 16:29:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 38376-01 for ; Thu, 22 Sep 2011 19:29:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) by mail.postgresql.org (Postfix) with ESMTP id A2E43B5DC3C for ; Thu, 22 Sep 2011 16:29:46 -0300 (ADT) Received: by qyk7 with SMTP id 7so3079050qyk.19 for ; Thu, 22 Sep 2011 12:29:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=qINXhmP3Yd7YDPWd2K7rjPPDOfy+5+ZmcPu2aMdOPRE=; b=G4PJqhC+XAp+EUoon3YME04fgF0cBiR0P4qFL6d93wAYNNrj+k0KqFya/IhA0hDVm8 JuIYm8QX6Y5iKO9OZQ4tx/zdU20iHL523Vh+2NJlji9k5+cjpaycqBKgIx9UTVrkRYOT eLzG06sf2XnxL/XzHcZvj4A6AHujE+3IdXNcw= Received: by 10.229.189.201 with SMTP id df9mr2016920qcb.117.1316719786136; Thu, 22 Sep 2011 12:29:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.213.83 with HTTP; Thu, 22 Sep 2011 12:29:25 -0700 (PDT) In-Reply-To: <4E7B815B.7080500@timbira.com> References: <1316524671.9044.12.camel@fsopti579.F-Secure.com> <4E794FB5.80400@2ndQuadrant.com> <1316613536.14119.6.camel@fsopti579.F-Secure.com> <4E7A6D0D.4060106@2ndQuadrant.com> <4E7A887F.8010908@timbira.com> <4E7B815B.7080500@timbira.com> From: Josh Kupershmidt Date: Thu, 22 Sep 2011 15:29:25 -0400 Message-ID: Subject: Re: somewhat wrong archive_command example To: Euler Taveira de Oliveira Cc: Greg Smith , pgsql-docs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 X-Spam-Level: X-Archive-Number: 201109/72 X-Sequence-Number: 6993 On Thu, Sep 22, 2011 at 2:41 PM, Euler Taveira de Oliveira wrote: > On 22-09-2011 15:15, Josh Kupershmidt wrote: >> =A01.) 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 te= st > is to handle a cp failure case nicely. Maybe I misunderstand you.. I was talking about this test, which was in Greg's script already: if [ ! -d ${ARCHIVE} ] ; then echo Archive directory does not exist >&2 exit 1 fi I don't see how it would make any difference performance-wise whether this block is moved up to right before the "if [ -f ${ARCHIVE}/${FILE} ] ; then" line: we expect both of these if-statements to evaluate false if they are reached. Josh