[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4 Setting Parameters for Backups and Restoration

The file ‘backup-specs’ specifies backup parameters for the backup and restoration scripts provided with tar. You must edit ‘backup-specs’ to fit your system configuration and schedule before using these scripts.

Syntactically, ‘backup-specs’ is a shell script, containing mainly variable assignments. However, any valid shell construct is allowed in this file. Particularly, you may wish to define functions within that script (e.g., see RESTORE_BEGIN below). For more information about shell script syntax, please refer to the definition of the Shell Command Language. See also (bashref)Top section `Bash Features' in Bash Reference Manual.

The shell variables controlling behavior of backup and restore are described in the following subsections.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4.1 General-Purpose Variables

Backup variable: ADMINISTRATOR

The user name of the backup administrator. Backup scripts sends a backup report to this address.

Backup variable: BACKUP_HOUR

The hour at which the backups are done. This can be a number from 0 to 23, or the time specification in form hours:minutes, or the string ‘now’.

This variable is used by backup. Its value may be overridden using ‘--time’ option (see section Using the Backup Scripts).

Backup variable: TAPE_FILE

The device tar writes the archive to. If TAPE_FILE is a remote archive (see remote-dev), backup script will suppose that your mt is able to access remote devices. If RSH (see RSH) is set, ‘--rsh-command’ option will be added to invocations of mt.

Backup variable: BLOCKING

The blocking factor tar will use when writing the dump archive. See section The Blocking Factor of an Archive.

Backup variable: BACKUP_DIRS

A list of file systems to be dumped (for backup), or restored (for restore). You can include any directory name in the list — subdirectories on that file system will be included, regardless of how they may look to other networked machines. Subdirectories on other file systems will be ignored.

The host name specifies which host to run tar on, and should normally be the host that actually contains the file system. However, the host machine must have GNU tar installed, and must be able to access the directory containing the backup scripts and their support files using the same file name that is used on the machine where the scripts are run (i.e., what pwd will print when in that directory on that machine). If the host that contains the file system does not have this capability, you can specify another host as long as it can access the file system through NFS.

If the list of file systems is very long you may wish to put it in a separate file. This file is usually named ‘/etc/backup/dirs’, but this name may be overridden in ‘backup-specs’ using DIRLIST variable.

Backup variable: DIRLIST

The name of the file that contains a list of file systems to backup or restore. By default it is ‘/etc/backup/dirs’.

Backup variable: BACKUP_FILES

A list of individual files to be dumped (for backup), or restored (for restore). These should be accessible from the machine on which the backup script is run.

If the list of individual files is very long you may wish to store it in a separate file. This file is usually named ‘/etc/backup/files’, but this name may be overridden in ‘backup-specs’ using FILELIST variable.

Backup variable: FILELIST

The name of the file that contains a list of individual files to backup or restore. By default it is ‘/etc/backup/files’.

Backup variable: MT

Full file name of mt binary.

Backup variable: RSH

Full file name of rsh binary or its equivalent. You may wish to set it to ssh, to improve security. In this case you will have to use public key authentication.

Backup variable: RSH_COMMAND

Full file name of rsh binary on remote machines. This will be passed via ‘--rsh-command’ option to the remote invocation of GNU tar.

Backup variable: VOLNO_FILE

Name of temporary file to hold volume numbers. This needs to be accessible by all the machines which have file systems to be dumped.

Backup variable: XLIST

Name of exclude file list. An exclude file list is a file located on the remote machine and containing the list of files to be excluded from the backup. Exclude file lists are searched in /etc/tar-backup directory. A common use for exclude file lists is to exclude files containing security-sensitive information (e.g., ‘/etc/shadow’ from backups).

This variable affects only backup.

Backup variable: SLEEP_TIME

Time to sleep between dumps of any two successive file systems

This variable affects only backup.

Backup variable: DUMP_REMIND_SCRIPT

Script to be run when it's time to insert a new tape in for the next volume. Administrators may want to tailor this script for their site. If this variable isn't set, GNU tar will display its built-in prompt, and will expect confirmation from the console. For the description of the default prompt, see change volume prompt.

Backup variable: SLEEP_MESSAGE

Message to display on the terminal while waiting for dump time. Usually this will just be some literal text.

Backup variable: TAR

Full file name of the GNU tar executable. If this is not set, backup scripts will search tar in the current shell path.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4.2 Magnetic Tape Control

Backup scripts access tape device using special hook functions. These functions take a single argument — the name of the tape device. Their names are kept in the following variables:

Backup variable: MT_BEGIN

The name of begin function. This function is called before accessing the drive. By default it retensions the tape:

 
MT_BEGIN=mt_begin

mt_begin() {
    mt -f "$1" retension
}
Backup variable: MT_REWIND

The name of rewind function. The default definition is as follows:

 
MT_REWIND=mt_rewind

mt_rewind() {
    mt -f "$1" rewind
}
Backup variable: MT_OFFLINE

The name of the function switching the tape off line. By default it is defined as follows:

 
MT_OFFLINE=mt_offline

mt_offline() {
    mt -f "$1" offl
}
Backup variable: MT_STATUS

The name of the function used to obtain the status of the archive device, including error count. Default definition:

 
MT_STATUS=mt_status

mt_status() {
    mt -f "$1" status
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4.3 User Hooks

User hooks are shell functions executed before and after each tar invocation. Thus, there are backup hooks, which are executed before and after dumping each file system, and restore hooks, executed before and after restoring a file system. Each user hook is a shell function taking four arguments:

User Hook Function: hook level host fs fsname

Its arguments are:

level

Current backup or restore level.

host

Name or IP address of the host machine being dumped or restored.

fs

Full file name of the file system being dumped or restored.

fsname

File system name with directory separators replaced with colons. This is useful, e.g., for creating unique files.

Following variables keep the names of user hook functions:

Backup variable: DUMP_BEGIN

Dump begin function. It is executed before dumping the file system.

Backup variable: DUMP_END

Executed after dumping the file system.

Backup variable: RESTORE_BEGIN

Executed before restoring the file system.

Backup variable: RESTORE_END

Executed after restoring the file system.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.4.4 An Example Text of ‘Backup-specs

The following is an example of ‘backup-specs’:

 
# site-specific parameters for file system backup.

ADMINISTRATOR=friedman
BACKUP_HOUR=1
TAPE_FILE=/dev/nrsmt0

# Use ssh instead of the less secure rsh
RSH=/usr/bin/ssh
RSH_COMMAND=/usr/bin/ssh

# Override MT_STATUS function:
my_status() {
      mts -t $TAPE_FILE
}
MT_STATUS=my_status

# Disable MT_OFFLINE function
MT_OFFLINE=:

BLOCKING=124
BACKUP_DIRS="
        albert:/fs/fsf
        apple-gunkies:/gd
        albert:/fs/gd2
        albert:/fs/gp
        geech:/usr/jla
        churchy:/usr/roland
        albert:/
        albert:/usr
        apple-gunkies:/
        apple-gunkies:/usr
        gnu:/hack
        gnu:/u
        apple-gunkies:/com/mailer/gnu
        apple-gunkies:/com/archive/gnu"

BACKUP_FILES="/com/mailer/aliases /com/mailer/league*[a-z]"


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Sergey Poznyakoff on October, 20 2013 using texi2html 1.78.