Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 752BD63412E for ; Wed, 31 Mar 2010 20:39:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 46982-10 for ; Wed, 31 Mar 2010 23:39:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id C6ED4632878 for ; Wed, 31 Mar 2010 20:39:20 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o2VNdLq23837; Wed, 31 Mar 2010 19:39:21 -0400 (EDT) From: Bruce Momjian Message-Id: <201003312339.o2VNdLq23837@momjian.us> Subject: Re: confusing archive_command example In-Reply-To: <4ec1cf761003290934l5e61efd3gdbddeeda3c6be185@mail.gmail.com> To: Josh Kupershmidt Date: Wed, 31 Mar 2010 19:39:21 -0400 (EDT) CC: pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ELM1270078761-9808-0_" Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/24 X-Sequence-Number: 5389 --ELM1270078761-9808-0_ Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" Josh Kupershmidt wrote: > Hi, > On the page: > http://www.postgresql.org/docs/current/interactive/continuous-archiving.html#BACKUP-ARCHIVING-WAL > > an example archive_command of: > archive_command = 'cp -i %p /mnt/server/archivedir/%f > is given. Then, a few lines later, an example archive command of: > archive_command = 'test ! -f .../%f && cp %p .../%f' > > is given. I think this second command would be more clear if it used > "/mnt/server/archivedir/" instead of "...", to tie in with the > previous archive_command. It took me a minute to figure out that the > three dots were supposed to be an ellipsis instead of a typo for the > parent directory "..". I agree our use of cp -i http://momjian.us EnterpriseDB http://enterprisedb.com --ELM1270078761-9808-0_ Content-Transfer-Encoding: 7bit Content-Type: text/x-diff Content-Disposition: inline; filename="/rtmp/diff" Index: doc/src/sgml/backup.sgml =================================================================== RCS file: /cvsroot/pgsql/doc/src/sgml/backup.sgml,v retrieving revision 2.144 diff -c -c -r2.144 backup.sgml *** doc/src/sgml/backup.sgml 22 Feb 2010 17:15:10 -0000 2.144 --- doc/src/sgml/backup.sgml 31 Mar 2010 23:34:20 -0000 *************** *** 604,614 **** directory). It is advisable to test your proposed archive command to ensure that it indeed does not overwrite an existing file, and that it returns ! nonzero status in this case. We have found that cp -i does ! this correctly on some platforms but not others. If the chosen command ! does not itself handle this case correctly, you should add a command ! to test for existence of the archive file. For example, something ! like: archive_command = 'test ! -f .../%f && cp %p .../%f' --- 604,615 ---- directory). It is advisable to test your proposed archive command to ensure that it indeed does not overwrite an existing file, and that it returns ! nonzero status in this case. On many Unix platforms, cp ! -i causes copy to prompt before overwriting a file, and ! < /dev/null causes the prompt (and overwriting) to ! fail. If your platform does not support this behavior, you should ! add a command to test for the existence of the archive file. For ! example, something like: archive_command = 'test ! -f .../%f && cp %p .../%f' --ELM1270078761-9808-0_--