]> arthur.barton.de Git - backup-script.git/blob - README.md
Add support for generations on ZFS
[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 used.
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 defauklt configuration variables are read from `/etc/backup-script.conf`,
42 from `/etc/backup-script.d/backup-script.conf` (deprecated). The individual
43 systems are configured using individual files in `/etc/backup-script.d/`, one
44 for each system to backup (files ending in `*.sh` are skipped).
45
46 Variables in `backup-script.conf` must be prefixed with `default_` to define
47 default values for all systems.
48
49 All default can be overwritten in individual system configuration files.
50
51 For example:
52
53 - `/etc/backups-script.conf`: defaults for all hosts
54 - `/etc/backups-script.d/host01.example.net`: configuration for host 1
55 - `/etc/backups-script.d/clientXY.example.com`: configuration for host 2
56
57
58 ## Configuration Variable
59
60 ### system
61
62 System host name. Default: file name.
63
64 *Note:* There is no `default_system` variable!
65
66 ### [default_]user
67
68 Remote user. Default: `root`.
69
70 ### [default_]source_root
71
72 Remote *root* directory, must end with a slash ("/") character! Default: "/".
73
74 When saving the whole (remote) system ("/"), default excludes are set up
75 automatically, which exclude standard system directories like /sys and /proc.
76
77 ### [default_]target
78
79 Local backup directory. The backup of each system is stored in a folder named
80 like the system (see `system` variable) inside of this target directory.
81
82 *Note:* There is *no* default, you have to specify this variable, for example as
83 `default_target` in the `backups-script.conf` file!
84
85 ### [default_]ssh_args_add
86
87 Additional parameters for `ssh`. Default: none.
88
89 ### [default_]rsync_args_add
90
91 Additional parameters for `rsync`. Default: none.
92
93 ### [default_]exclude_args_add
94
95 Additional (exclude) parameters for `rsync`. Default: none.
96
97 ### [default_]compress
98
99 Enable (1) or disable (0) compression. Default: 1 (on).
100
101 ### [default_]ping
102
103 Enable (1) or disable (0) ping'ing the target system to make sure that it is
104 reachable before calling `rsync`. Default: 1 (on).
105
106 ### [default_]local
107
108 Enable (1) or disable (0) *local mode*: when local mode is in effect, `rsync` is
109 called without using `ssh`, which is a good idea when saving the local system.
110 Default: 0 (off; use ssh).
111
112 ### [default_]generations
113
114 Number of generations to keep. Default: 0 (none).
115
116 On a suitable target file systems (see `target` variable), this script can
117 generate generations using snapshots: the script creates a new snapshot
118 named with the timestamp for each generation inside of the system directory
119 inside of the target directory.
120
121 Supported file systems are:
122
123  * *btrfs*:
124    All generations are btrfs subvolumes and named after the date and time.
125  * *ZFS*:
126    All generations are ZFS filesystems. Latest generation is named `current`,
127    olders are links to the ZFS snapshot directories.
128
129 The latest snapshot is always reachable using a symlink named `latest`
130 inside the system directory.
131
132 ### [default_]job_pre_exec
133
134 Optional script to execute before `rsync` starts. Default: none.
135
136 When the `job_pre_exec` script returns an error (exit code is not 0), the backup
137 run is skipped!
138
139 ### [default_]job_post_exec
140
141 Optional script to execute after `rsync` exited. Default: none.
142
143 ### Compatibility Variables
144
145 The following configurations variables used by the backup-pull(1) script in job
146 definition files are automatically mapped to the new backup-script variables:
147
148 * host -> system
149 * source -> source_root
150 * pre_exec -> job_pre_exec
151 * post_exec -> job_post_exec