MIRROR(1)

NAME
mirror - Highly Configurable N-Level Automatic Backup Utility

SYNOPSIS
mirror options

DESCRIPTION
mirror is usually called daily by a CRON job, and is usually also called on system startup (on desktop systems that are shutdown and restarted daily). It then determines what is necessary to perform a backup of the desired and configured kind, and performs that backup by calling GNU tar with appropriate options.

It is common to configure a multilevel backup of the kind "every 16 days a full level-0 backup to tape, every 4 days a differential level-1 backup over the network, and daily a differential level-2 backup to a local harddisk."

PREREQUISITES
Necessary tools for using mirror are the GNU version of tar, gzip, a running email setup (mirror calls the mail command), and the tape utility mt (if tape backups are configured). For network backups, rsh needs to be setup and functioning.

OPTIONS
mirror is highly configurable, mainly through a configuration file. However, it also takes a couple of options: prints the version number and exits. specifies the configuration file. Default is the file .mirrorrc in the caller's home directory. sets the maximum level of the backup done. This is useful if, say, you have configured a 3-level backup, level-2 goes to a harddisk and is due today, but you know there have been so many changes to the system that the harddisk cannot store this backup. Then, you want to force a backup of level 1, using the option --maxlevel 1. Implies option --force. forces a backup even if the last successful backup has been performed today, in which case mirror stops printing a message.

The following options can be specified both on the command line and in the configuration file. Switches to debug mode, in which no real action is performed, only a report is printed. You have to enter the size of the (fictive) backup in MB so you can track what mirror would do in a certain situation. Implies --force. This option can be negated (--nodebug) and is off by default.

ENVIRONMENT
Default arguments. These are simply prepended to the command line argument on every call of mirror.

CONFIGURATION FILE
mirror is configured by a Perl configuration file with a fairly simple syntax. The configuration file is expected by default to be ~/.mirrorrc but different names can be specified on the command line.

An example configuration file explaining all the available options is given in the following:

 #! Call this config script as
 # "mirror --configfile <config>"
 %config =
 (
   # 1. General backup setup
   # Directory for snapshot files,
   # status/lock file, and temporary data
   snapshotdir => "/root/snapshots",
   # List of files/dirs to be included/excluded
   # in the backup (one file name per line)
   includelist => "/root/mirror.conf/include",
   excludelist => "/root/mirror.conf/exclude",
   # Base name of the backup files.
   # This default is pretty sensible.
   basename => "$host",
   # Must be root to do this backup?
   # ("yes" or "no")
   must_be_root => "no",
   # 2. Tool setup

   tar => "tar",            # tar command to use
   compressopt => "--gzip", # compression option to use
   extension => "tgz",      # backup file name extension
   debug => "no",           # debug mode
   # Email setup
   email => "$user\@$host", # email addresses for messages
   cc => "$user\@$host",    # possible second email address
   # Third email address
   # (used in case of errors and for user notification)
   emergency_cc => "$user\@$host",
   # Backup level configuration
   # number of levels is 3: level-0 through level-3
   # (arbitrary number of levels possible)
   levels => 4,
   # Specify number of backups on each level
   # before next lower level is due
   maxcount =>
   {
     0 => 0,  # infinite number of level-0 (full) backups
     1 => 10, # max. 10 x level-1 before next level-0
     2 => 5,  # max. 5 x level-2 before next level-1
     3 => 5   # max. 5 x level-3 before next level-2
   },
   # Specify type of backup on each level.
   # The names given here are arbitrary but must
   # each contain exactly one of the substrings "notify",
   # "tape", "remote" or "harddisk" to specify the type of
   # backup. The names correspond to the names of
   # the separate entries below.
   backuptype =>
   {
     0 => "notify_me",      # notify user
     1 => "streamer_tape",  # backup to local tape
     2 => "remote_machine", # backup over network
     3 => "harddisk"        # backup to mounted harddisk
   },

   # This is a typical harddisk backup configuration.
   # These may have different names but must contain
   # a "harddisk" in their name.
   harddisk =>
   {
     path => "/bkup", # where to put the backup files...
   },
   # This is a typical tape backup configuration.
   # These may have different names but must contain
   # a "tape" in their name.
   streamer_tape =>
   {
     # The type device (must be non-rewinding!).
     device => "/dev/nst0",
     # Optional tape capacity in MB.
     capacity => 4000
   },
   # This is an example remote backup configuration
   # These may have different names but must contain
   # a "remote" in their name.
   remote_machine =>
   {
     path => "$user\@jumbo:/archive/$host",
   },
   # This is a typical notification backup configuration
   # If notification is configured, the user is sent an
   # email, and after the script is started again (by
   # hand or CRON or whatever), the backup is done.
   # If desired, a second notification is sent afterwards.
   # This emailing has the goal to remind the user to
   # change media before the backup is done, and
   # afterwards to change media back. These notification
   # backups may have different names but must contain
   # a "notify" in their name.
   notify_me =>
   {
     # what to do on next run
     restart => "othertape",
     # notify again after restart?
     notify_again => "yes",
   },
   # After getting our email notification, the user
   # restarts the program and we have to do this
   # (note that this is again a tape backup, to
   # be seen by the "tape" in the name).
   othertape =>
   {
     device => "/dev/nst0"
   },
 );

FILES
The mirror script. The man page, generated from Perl's POD. You can produce the manpage by typing 'pod2man mirror >mirror.1'

BUGS
No bugs are known :-)

AUTHOR
Copyright 1998 by Chris Traxler <christoph.t.traxler@theo.physik.uni-giessen.de>. The GNU general public license applies.

You are permitted to use and alter mirror under the terms of the GNU GPL. If you alter this file (and improve the program), I kindly ask you to send a copy to me at christoph.t.traxler@theo.physik.uni-giessen.de. You can retrieve a copy of the precise license terms at the URL ftp://prep.ai.mit.edu/pub/gnu/COPYING-2.0

mirror can be retrieved from any CPAN mirror or from ftp://krabat.physik.uni-giessen.de/pub/traxler/