Re: refdb-backup portability and design
David Nebauer <[email protected]>
| Newsgroups | gmane.text.refdb.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Markus, >There were two portability issues: > >- cut does not understand the long options on many platforms. It is > better to use something like cut -d ' ' -f 1. > >- select is a bash feature. Although you use #!/bin/sh at the top, > you'll actually run bash on Linux (try ls -al /bin/sh). The BSDs > have a real sh which is different from bash. Therefore I have to > ask for bash explicitly in the shebang on FreeBSD. > >Another, more general problem is that I see a great potential of this >script to run backups automatically. I'd like to define a cron job >that runs this script once a week or so. For this to work we'd need a >way to pass parameters on the command line instead of an interactive >interface. > >Therefore I'd suggest to use getopt or getopts to read the required >user input from the command line. getopt is a standalone POSIX >utility, could be used from sh, and should be available on all >platforms. On the other hand, getopts is a bash builtin and simpler to >use. > >I can handle the getopts/bash stuff if you agree. Let me know what you >think. > I've checked in new versions of the utilities. There are some major alterations which should alleviate most of your concerns. There is now no user interactivity -- all input is via command line arguments (handled by getopts). Username and password are now accepted as arguments and these are passed through to all refdba and refdbc commands. The bash-specific constructs you identified (select, cut long options) have been removed/fixed. One of the barriers to automating these utilities was the need for refdb-backup to run in a blank directory. Both utilities now use temporary directories (courtesy of 'mktemp'). Previously the archive was created in the run directory -- users can now supply the target directory for archive creation via a command line argument. The scripts now check for refdba|c access before running. The restore script no longer generates a log file. Please give this version a hammering to make sure I covered all possible error states. While I've cleaned up some portability issues I may have introduced others! Regards, David. ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl