]> arthur.barton.de Git - backup-script.git/blob - README.md
README.md: Update "configuration" section
[backup-script.git] / README.md
1 # Backup Script
2
3 A script for cloning systems using rsync.  
4 Copyright (c)2008-2015 Alexander Barton <alex@barton.de>
5
6
7 ## Usage
8
9 ### backup-script
10
11 Backup all or individual systems.
12
13 Usage: `backup-script [<options>] [<system> [<system> [...]]]`
14
15 Options:
16
17 - `-p`, `--progress`: Show progress, see rsync(1).
18 - `-n`, `--dry-run`: Test run only, don't copy any data.
19
20 When no *system* is given, all defined systems are backed up.
21
22 ### backup-script-wrapper
23
24 Backup all systems and mail the report to "root".
25
26 Usage: `backup-script-wrapper`
27
28 ### backup-status
29
30 Show information about backups.
31
32 Usage: `backup-status [-q] [<system> [<system> [...]]]`
33
34 Options:
35
36 - `-q`: *quick mode*, don't calculate backup sizes.
37
38
39 ## Configuration
40
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).
44
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.
49
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.
54
55 Variables in `backup-script.conf` must be prefixed with `default_` to define
56 default values for all systems.
57
58 All defaults can be overwritten in the individual system configuration files.
59
60 For example:
61
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
65
66
67 ## Configuration Variables
68
69 ### system
70
71 System host name. Default: file name.
72
73 *Note:* There is no `default_system` variable!
74
75 ### [default_]user
76
77 Remote user. Default: `root`.
78
79 ### [default_]source_root
80
81 Remote *root* directory, must end with a slash ("/") character! Default: "/".
82
83 When saving the whole (remote) system ("/"), default excludes are set up
84 automatically, which exclude standard system directories like /sys and /proc.
85
86 ### [default_]target
87
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.
90
91 *Note:* There is *no* default, you have to specify this variable, for example as
92 `default_target` in the `backups-script.conf` file!
93
94 ### [default_]ssh_args_add
95
96 Additional parameters for `ssh`. Default: none.
97
98 ### [default_]rsync_args_add
99
100 Additional parameters for `rsync`. Default: none.
101
102 ### [default_]exclude_args_add
103
104 Additional (exclude) parameters for `rsync`. Default: none.
105
106 ### [default_]compress
107
108 Enable (1) or disable (0) compression. Default: 1 (on).
109
110 ### [default_]ping
111
112 Enable (1) or disable (0) ping'ing the target system to make sure that it is
113 reachable before calling `rsync`. Default: 1 (on).
114
115 ### [default_]local
116
117 Enable (1) or disable (0) *local mode*: when local mode is in effect, `rsync` is
118 called without using `ssh`, which is a good idea when saving the local system.
119 Default: 0 (off; use ssh).
120
121 ### [default_]generations
122
123 Number of generations to keep. Default: 0 (none).
124
125 On a suitable target file systems (see `target` variable), this script can
126 generate generations using snapshots: the script creates a new snapshot
127 named with the time stamp for each generation inside of the system directory
128 inside of the target directory.
129
130 Supported file systems are:
131
132  * *btrfs*:
133    All generations are btrfs subvolumes and named after the date and time.
134  * *ZFS*:
135    All generations are ZFS file systems. Latest generation is named `current`,
136    elders are links to the ZFS snapshot directories.
137
138 The latest snapshot is always reachable using a symlink named `latest`
139 inside the system directory.
140
141 ### [default_]job_pre_exec
142
143 Optional script to execute before `rsync` starts. Default: none.
144
145 When the `job_pre_exec` script returns an error (exit code is not 0), the backup
146 run is skipped!
147
148 ### [default_]job_post_exec
149
150 Optional script to execute after `rsync` exited. Default: none.
151
152 ### Compatibility Variables
153
154 The following configurations variables used by the backup-pull(1) script in job
155 definition files are automatically mapped to the new backup-script variables:
156
157 * host -> system
158 * source -> source_root
159 * pre_exec -> job_pre_exec
160 * post_exec -> job_post_exec
161
162
163 ## Exit codes
164
165 - 1: Unspecific Error!
166 - 2: Usage information has been shown.
167 - 3: Can't read system definition
168 - 4: PID-file exists!
169 - 5: Pre-exec command failed!
170 - 6: There have been systems with errors!
171 - 7: Not all jobs were run!
172 - 9: Aborted (CTRL-C)!