Scripted Backups (GNU tar 1.35)

### 5.5 Using the Backup Scripts

The syntax for running a backup script is:

    backup --level=level --time=time

The `--level` option requests the dump level. Thus, to produce a full dump, specify `--level=0` (this is the default, so `--level` may be omitted if its value is `0`)14.

The `--time` option determines when should the backup be run. Time may take three forms:

hh:mm

  The dump must be run at hh hours mm minutes.

hh

  The dump must be run at hh hours.

now

  The dump must be run immediately.

You should start a script with a tape or disk mounted. Once you start a script, it prompts you for new tapes or disks as it needs them. Media volumes don’t have to correspond to archive files — a multi-volume archive can be started in the middle of a tape that already contains the end of another multi-volume archive. The `restore` script prompts for media by its archive volume, so to avoid an error message you should keep track of which tape (or disk) contains which volume of the archive (see Using the Restore Script).

The backup scripts write two files on the file system. The first is a record file in `/etc/tar-backup/`, which is used by the scripts to store and retrieve information about which files were dumped. This file is not meant to be read by humans, and should not be deleted by them. See Format of the Incremental Snapshot Files, for a more detailed explanation of this file.

The second file is a log file containing the names of the file systems and files dumped, what time the backup was made, and any error messages that were generated, as well as how much space was left in the media volume after the last volume of the archive was written. You should check this log file after every backup. The file name is `log-mm-dd-yyyy-level-n`, where mm-dd-yyyy represents current date, and n represents current dump level number.

The script also prints the name of each system being dumped to the standard output.

Following is the full list of options accepted by `backup` script:

`-l level`
`--level=level`

  Do backup level level (default 0).

`-f`
`--force`

  Force backup even if today’s log file already exists.

`-v[level]`
`--verbose[=level]`

  Set verbosity level. The higher the level is, the more debugging information will be output during execution. Default level is 100, which means the highest debugging level.

`-t start-time`
`--time=start-time`

  Wait till time, then do backup.

`-h`
`--help`

  Display short help message and exit.

`-V`
`--version`

  Display information about the program’s name, version, origin and legal status, all on standard output, and then exit successfully.

#### Footnotes

##### (14)

For backward compatibility, the `backup` will also try to deduce the requested dump level from the name of the script itself. If the name consists of a string ‘`level-`’ followed by a single decimal digit, that digit is taken as the dump level number. Thus, you may create a link from `backup` to `level-1` and then run `level-1` whenever you need to create a level one dump.