Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B340DB5DC1A for ; Thu, 22 Sep 2011 15:42:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 63863-03 for ; Thu, 22 Sep 2011 18:42:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from oproxy3-pub.bluehost.com (oproxy3-pub.bluehost.com [69.89.21.8]) by mail.postgresql.org (Postfix) with SMTP id 6C9A4B5DC09 for ; Thu, 22 Sep 2011 15:42:40 -0300 (ADT) Received: (qmail 23325 invoked by uid 0); 22 Sep 2011 18:42:38 -0000 Received: from unknown (HELO host159.hostmonster.com) (74.220.207.159) by oproxy3.bluehost.com with SMTP; 22 Sep 2011 18:42:36 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=timbira.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=fnpS8gxN/uAvrmVV5uOqVk52GsGsfvYEjoWXHacupH0=; b=eKhQwbF0fU07QDFoc2VclWHXjzd79opdJRNCJ4gXftwoP8xRO6Alxai5Bm7OlMptPaDjpwdEz8Wb+KzcNOAo1DQGa1a87yq9pH4tPReaHGTANyXmWsRz8PG1h+bDEZnN; Received: from [201.2.89.169] (helo=[10.3.2.2]) by host159.hostmonster.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1R6oEF-0007cb-KA; Thu, 22 Sep 2011 12:42:35 -0600 Message-ID: <4E7B815B.7080500@timbira.com> Date: Thu, 22 Sep 2011 15:41:31 -0300 From: Euler Taveira de Oliveira User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Icedove/3.1.13 MIME-Version: 1.0 To: Josh Kupershmidt CC: Greg Smith , pgsql-docs@postgresql.org Subject: Re: somewhat wrong archive_command example 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> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Identified-User: {1651:host159.hostmonster.com:timbirac:timbira.com} {sentby:smtp auth 201.2.89.169 authed with euler@timbira.com} X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201109/71 X-Sequence-Number: 6992 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