Re: somewhat wrong archive_command example
От | Peter Eisentraut |
---|---|
Тема | Re: somewhat wrong archive_command example |
Дата | |
Msg-id | 1316613536.14119.6.camel@fsopti579.F-Secure.com обсуждение исходный текст |
Ответ на | Re: somewhat wrong archive_command example (Greg Smith <greg@2ndQuadrant.com>) |
Ответы |
Re: somewhat wrong archive_command example
|
Список | 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.
В списке pgsql-docs по дате отправления: