Implementation Notes

These scripts demonstrate that it’s not too hard to output scripts results in XML format. CDATA sections are used to capture commands and the output of those commands. Command text is a child of the Command element. Any command output that is not explicitly redirected to a file is saved as a child of the ConsoleText element.

Some output that is not useful to these scripts, like the output of the pushd and popd commands in the Unix version of these scripts, is ignored. That is, it is redirected to /dev/null in the Unix version and nul in the Microsoft Windows version.

Functions are defined in the order they are used within each calling depth. Bash requires that functions be defined before they are used. The main procedure must be at the bottom of the script. This is not a requirement for the Microsoft Windows version, but I put the main procedure at the end so that the structure of the scripts is similar.

Indentation of the script follows the indentation of the XML output. This is an attempt to make it easier to correlate the script commands with the XML output.

Each step sets and restores the working directory if needed (using pushd and popd).

tar strips the leading / from path so that the archives can be restored to an alternate location. The scripts have to use full paths because depot versioned file trees can be located anywhere. They do not need to be located under the server root (where the metadata database is). Ntbackup can also restore to an alternate location.

You cannot directly specify files to be backed up on the ntbackup command line. You can only specify directories. Since we want to backup the checkpoint and license files, we’ll have to create a backup selection file that contains the items we want to backup. The backup selection file is a Unicode encoded file with paths listed one per line. Directory paths end with “\”. We can then use this backup selection file on the ntbackup command line. The backup selection file should not have a byte order mark.

If you get result code 141 from tar, it probably means that the disk containing the backup directory is full.

If you get result code 31 from ntbackup, it probably means an error occurred when writing the archive file.

Viewing the Results as HTML

JavaScript functions are used in the generated HTML to compute elapsed times and trim leading and trailing whitespace from error text. This approach does not require XSLT extensions.

The overall start and end times (from the /BackupProcedure/Summary element) are used to compute the total elapsed time. This eliminates the accumulated rounding errors that would occur if the elapsed times of each step were summed. Therefore, the total elapsed time displayed in the Steps table might not equal the sum of the elapsed times for each step.

The RSS feeds do not use any embedded HTML. Different web browsers and RSS readers vary in their support for embedded HTML.

The scripts used to generate the RSS feeds do not use any XSLT extensions to enable greater portability.