3 A script for cloning systems using rsync.
4 Copyright (c)2008-2015 Alexander Barton <alex@barton.de>
11 Backup all or individual systems.
13 Usage: `backup-script [<options>] [<system> [<system> [...]]]`
17 - `-p`, `--progress`: Show progress, see rsync(1).
18 - `-n`, `--dry-run`: Test run only, don't copy any data.
20 When no *system* is given, all defined systems are backed up.
22 ### backup-script-wrapper
24 Backup all systems and mail the report to "root".
26 Usage: `backup-script-wrapper`
30 Show information about backups.
32 Usage: `backup-status [-q] [<system> [<system> [...]]]`
36 - `-q`: *quick mode*, don't calculate backup sizes.
41 All default configuration variables are read from the first file found of this
42 list: `/usr/local/etc/backup-scrupt.conf`, `/etc/backup-script.conf` or
43 from `/etc/backup-script.d/backup-script.conf` (deprecated).
45 All systems which should be backed-up are configured using individual files
46 in the configuration directory, which is `/usr/local/etc/backup-script.d/` or
47 `/etc/backup-script.d/` by default (whichever is found first), and can be
48 specified using the `conf_d` variable in the main configuration file.
50 The must be one file for each system to backup (files ending in `*.sh` are
51 skipped, as well as files named `backup-script.conf`). Please avoid spaces and
52 other "special" characters! The filename is used as hostname for the system by
53 default, but this can be overwritten using the `system` configuration variable.
55 Variables in `backup-script.conf` must be prefixed with `default_` to define
56 default values for all systems.
58 All defaults can be overwritten in the individual system configuration files.
62 - `/etc/backups-script.conf`: defaults for all hosts
63 - `/etc/backups-script.d/host01.example.net`: configuration for host 1
64 - `/etc/backups-script.d/clientXY.example.com`: configuration for host 2
67 ## Configuration Variables
71 System host name. Default: file name.
73 *Note:* There is no `default_system` variable!
77 Remote user. Default: `root`.
79 ### [default_]source_root
81 Remote *root* directory, must end with a slash ("/") character! Default: "/".
83 When saving the whole (remote) system ("/"), default excludes are set up
84 automatically, which exclude standard system directories like /sys and /proc.
88 Local backup directory. The backup of each system is stored in a folder named
89 like the system (see `system` variable) inside of this target directory.
91 *Note:* There is *no* default, you have to specify this variable, for example as
92 `default_target` in the `backups-script.conf` file!
94 ### [default_]ssh_args_add
96 Additional parameters for `ssh`. Default: none.
98 ### [default_]rsync_args_add
100 Additional parameters for `rsync`. Default: none.
102 ### [default_]exclude_args_add
104 Additional (exclude) parameters for `rsync`. Default: none.
106 *Deprecated! Use "exclude_dirs_add" instead!*
108 ### [default_]exclude_dirs_add
110 Additional directory path names to exclude from the backup. Use full path names
111 separated by spaces. Default: none.
113 ### [default_]compress
115 Enable (1) or disable (0) compression. Default: 1 (on).
119 Enable (1) or disable (0) ping'ing the target system to make sure that it is
120 reachable before calling `rsync`. Default: 1 (on).
124 Enable (1) or disable (0) *local mode*: when local mode is in effect, `rsync` is
125 called without using `ssh`, which is a good idea when saving the local system.
126 Default: 0 (off; use ssh).
128 ### [default_]generations
130 Number of generations to keep. Default: 0 (none).
132 On a suitable target file systems (see `target` variable), this script can
133 generate generations using snapshots: the script creates a new snapshot
134 named with the time stamp for each generation inside of the system directory
135 inside of the target directory.
137 Supported file systems are:
140 All generations are btrfs subvolumes and named after the date and time.
142 All generations are ZFS file systems. Latest generation is named `current`,
143 elders are links to the ZFS snapshot directories.
145 The latest snapshot is always reachable using a symlink named `latest`
146 inside the system directory.
148 ### [default_]job_pre_exec
150 Optional script to execute before `rsync` starts. Default: none.
152 When the `job_pre_exec` script returns an error (exit code is not 0), the backup
155 ### [default_]job_post_exec
157 Optional script to execute after `rsync` exited. Default: none.
159 ### Compatibility Variables
161 The following configurations variables used by the backup-pull(1) script in job
162 definition files are automatically mapped to the new backup-script variables:
165 * source -> source_root
166 * pre_exec -> job_pre_exec
167 * post_exec -> job_post_exec
172 - 1: Unspecific Error!
173 - 2: Usage information has been shown.
174 - 3: Can't read system definition
175 - 4: PID-file exists!
176 - 5: Pre-exec command failed!
177 - 6: There have been systems with errors!
178 - 7: Not all jobs were run!
179 - 9: Aborted (CTRL-C)!