• No se han encontrado resultados

PARTE I. CONSTRUCCION TEORICA

7. Estrategias de preservación

The

bruxpat

File and the

-X

Option

In addition to the standard BRU options for selecting files-by date, user, or owner - BRU lets you include or exclude files by name. This feature is enabled with the -X (uppercase X) option. The -X option can be used when you are creating an archive (-c mode) or extracting files from an archive (-x mode). Additionally, the bruxpat file is used when using BRU’s software compression to exclude specified file types from the compression pass.

When you include the -X option on the BRU command line, BRU will apply include/exclude patterns specified in the /etc/bruxpat file (the default pattern file). The filenames encountered by BRU as it does a backup (or restore) will be compared to the patterns. If a filename matches any of the exclude patterns, it will not be backed up (or restored). Normally patterns will be read from the /etc/bruxpat file. BRU will use patterns from a different file if the environment variable BRUXPAT is set to the name of the new file. For example:

BRUXPAT=/etc/newbruxpat export BRUXPAT

The bruxpat file is also used to disable compression on certain files (-Z option). If many of your files are already compressed, you can enter a line in the bruxpat file that tells BRU not to compress files whose names indicate that they are already compressed. You may, for example, want to disable compression for files with filenames that end in “.Z” or “.z” or MP3 files (which are already highly compressed).

Specifying Include/Exclude Patterns

Each line in the bruxpat file consists of a control field and a pattern. The pattern is separated from the control field by a space or tab (whitespace). The include/exclude patterns can be specified as shell wildcard expressions or as regular expressions (as used by commands like grep and sed). Lines beginning with the ‘#’ character are treated as comments.

The control field consists of two characters. The first character specifies the type of action, the second specifies the type of pattern. The control field characters are described below:

The Control Field: Action Type Characters

i Include this pathname if the pattern matches. The pathname is accepted and no further patterns are applied.

x Exclude this pathname if the pattern matches. The pathname is rejected and no further patterns are applied.

z Disable compression for pathnames that match this pattern. Applies only if compression is specified (the -Z option).

The Control Field: Pattern Type Characters

s The pattern is a shell style wildcard pattern except that ‘/’ characters are not treated as special characters.

r The pattern is a regular expression. l The pattern is a literal string.

The Pattern Field

The pattern may be one of the three types specified above under “Pattern Type Characters.” The way in which shell wildcard patterns and regular expressions are formed can be found in the standard UNIX documentation. NOTE: Be aware of any trailing whitespace on ANY non-comment line. This can cause unexpected problems with BRU.

A Sample bruxpatFile

Here is a typical bruxpat file with patterns used to include and exclude files: #

# Sample bruxpat

# Not all of these are necessary and are # provided for example ONLY!

# Include the C runtime startup file but # exclude all other object

# files. is */crt0.o xs *.o

# Exclude all core files. xs */core

xs core

# Exclude files and subdirectories in # the temporary directories. Handle # both relative and absolute

# form pathnames. xs ./usr/tmp/* xs /usr/tmp/* xs ./tmp/* xs /tmp/*

# Don’t waste time trying to compress # files that are already compressed zs *.[Zz] zs *.gz zs *.bz2 zs *.mp3 zs *.gif zs *.jpg

The patterns act as filters that are applied to pathnames currently known by BRU. A pathname currently known by BRU is any pathname included by default (the current directory and everything below the current directory) or specified on the BRU command line (either explicitly or read in from files). The -X option will not cause BRU to select or include any files that are not part of the current directory or that are not among the directories or files specified as part of the

BRU command line.

Testing Include/Exclude Patterns

Filter patterns may produce unexpected results, especially if several patterns are specified. It is wise to do a test before you attempt a backup. The following command will test which files will be extracted from an archive, and will write the pathnames selected to xtest.out using the extract pattern(s) specified in /etc/bruxpat (or the file named in the environment variable BRUXPAT). Test your parameters without doing an actual backup by using the following BRU command:

bru -evvvv -X > ctest.out

Running BRU in -e mode will not perform an actual backup; instead it will print all the selected pathnames, in this case sending them to the file named ctest.out. If this file contains the pathnames you expect, then it is safe to do a backup with the

-c option substituted for -e: bru -cvvvv -X

You can test patterns used for file extraction in a similar manner by using the -t option. The following command will test which files will be extracted from an archive, and will write the table of contents to xtest.out using the extract pattern(s) specified in /etc/bruxpat (or the file named in the environment variable BRUXPAT):

bru -tvvvv -X > xtest.out

Again, if xtest.out contains the pathnames you expect, it is safe to restore files, substituting -x for -t:

bru -xvvvv -X

NOTE: To use the combination of the -T along with the -X options refer to Chapter