]> arthur.barton.de Git - backup-script.git/blob - README.md
Add "[default_]exclude_dirs_add" options
[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 *Deprecated! Use "exclude_dirs_add" instead!*
107
108 ### [default_]exclude_dirs_add
109
110 Additional directory path names to exclude from the backup. Use full path names
111 separated by spaces. Default: none.
112
113 ### [default_]compress
114
115 Enable (1) or disable (0) compression. Default: 1 (on).
116
117 ### [default_]ping
118
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).
121
122 ### [default_]local
123
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).
127
128 ### [default_]generations
129
130 Number of generations to keep. Default: 0 (none).
131
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.
136
137 Supported file systems are:
138
139  * *btrfs*:
140    All generations are btrfs subvolumes and named after the date and time.
141  * *ZFS*:
142    All generations are ZFS file systems. Latest generation is named `current`,
143    elders are links to the ZFS snapshot directories.
144
145 The latest snapshot is always reachable using a symlink named `latest`
146 inside the system directory.
147
148 ### [default_]job_pre_exec
149
150 Optional script to execute before `rsync` starts. Default: none.
151
152 When the `job_pre_exec` script returns an error (exit code is not 0), the backup
153 run is skipped!
154
155 ### [default_]job_post_exec
156
157 Optional script to execute after `rsync` exited. Default: none.
158
159 ### Compatibility Variables
160
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:
163
164 * host -> system
165 * source -> source_root
166 * pre_exec -> job_pre_exec
167 * post_exec -> job_post_exec
168
169
170 ## Exit codes
171
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)!