From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Greg Smith <greg(at)2ndQuadrant(dot)com> |
Cc: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: somewhat wrong archive_command example |
Date: | 2011-09-21 13:58:56 |
Message-ID: | 1316613536.14119.6.camel@fsopti579.F-Secure.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
On tis, 2011-09-20 at 22:45 -0400, Greg Smith wrote:
> Attached is a working local_backup_script.sh that does the same basic
> thing as the "Standalone Hot Backups" example. It includes lots of
> error checking, useful messages when it doesn't work like this:
>
> Archive directory does not exist
> LOG: archive command failed with exit code 1
> DETAIL: The failed archive command was: ./local_backup_script.sh
> pg_xlog/00000001000000010000007D 00000001000000010000007D
>
> And it takes advantage of the fact that scripts will be executed in
> $PGDATA, by putting all the paths it uses relative to it.
>
> If I could get some general agreement this is a good direction to
> wander
> in, I'd be happy to wrap this into a full doc patch and submit it.
> I've
> been meaning to do this for a while and just never got around to it.
I can see a few problems with your script, as far as making it into a
generally reusable example:
- Uses bash. Portable scripts shouldn't do this.
- Overwrites PATH variable for unrelated purpose.
- Path ($PATH) should be quoted everywhere. (By contrast, you don't
need the quotes in PATH="$1". Just saying ...)
- cp shouldn't be called with an absolute path.
I guess this only supports the point that even a small script can
contain lots of traps, so providing a robust example would be helpful.
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2011-09-21 14:33:36 | Re: coalesce |
Previous Message | Henry Drexler | 2011-09-21 12:34:33 | coalesce |