bd0e7745d2c3acaeac91685b70ea658d8894c8df
[dss.git] / dss.ggo
1 # Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
2 #
3 # Licensed under the GPL v2. For licencing details see COPYING.
4
5 package "dss"
6 version "0.0.5"
7 purpose "the dyadic snapshot scheduler
8
9 dss creates hardlink-based snapshots of a given directory on a remote
10 or local host using rsync's link-dest feature.
11 "
12
13 #########################
14 section "General options"
15 #########################
16
17 option "config-file" c
18 #~~~~~~~~~~~~~~~~~~~~~
19 "(default='~/.dssrc')"
20 string typestr="filename"
21 optional
22 details="
23 Options may be given at the command line or in the
24 configuration file. As usual, if an option is given both at
25 the command line and in the configuration file, the command
26 line option takes precedence.
27
28 However, there is an important exception to this rule:
29 If the --run option was given (see below) then dss honors
30 SIGHUP and re-reads its configuration file whenever it
31 receives this signal. In this case the options in the config
32 file override any options that were previously given at the
33 command line. This allows to change the configuration of a
34 running dss process on the fly by sending SIGHUP.
35 "
36
37 option "daemon" d
38 #~~~~~~~~~~~~~~~~
39 "Run as background daemon"
40 flag off
41 dependon="logfile"
42 details="
43 Note that dss refuses to start in daemon mode if no logfile
44 was specified. This option is mostly useful in conjuction
45 with the -R option described below.
46
47 Note that it is not possible to change whether dss runs as
48 background daemon by sending SIGHUP.
49 "
50
51 option "dry-run" D
52 #~~~~~~~~~~~~~~~~~
53 "Only print what would be done"
54 flag off
55 details="
56 This flag does not make sense for all commands. The run
57 command refuses to start if this option was given. The ls
58 command silently ignores this flag.
59 "
60
61 #################
62 section "Logging"
63 #################
64
65 option "loglevel" l
66 #~~~~~~~~~~~~~~~~~~
67 "Set loglevel (0-6)"
68 int typestr="level"
69 default="3"
70 optional
71 details="
72 Lower values mean more verbose logging.
73 "
74
75 option "logfile" -
76 #~~~~~~~~~~~~~~~~~
77 "Logfile for the dss daemon process"
78 string typestr="filename"
79 optional
80 details="
81 This option is mostly useful for the run command if --daemon
82 is also given.
83 "
84
85 defgroup "command"
86 #=================
87 groupdesc="
88 dss supports a couple of commands each of which corresponds
89 to a different command line option. Exactly one of these
90 options must be given.
91 "
92 required
93
94 groupoption "create" C
95 #~~~~~~~~~~~~~~~~~~~~~
96 "Create a new snapshot"
97 group="command"
98 details="
99 Execute the rsync command to create a new snapshot. Note that
100 this command does not care about free disk space.
101 "
102
103 groupoption "prune" P
104 #~~~~~~~~~~~~~~~~~~~~
105 "Remove a redundant snapshot"
106 group="command"
107 details="
108 A snapshot is considered redundant if it ether belongs to
109 an interval greater than the maximum number of intervals,
110 or if it belongs to an interval that already contains more
111 than the desired number of snapshots.
112 "
113
114 groupoption "ls" L
115 #~~~~~~~~~~~~~~~~~
116 "Print a list of all snapshots"
117 group="command"
118 details="
119 The list will contain all snapshots no matter of their state,
120 i. e. incomplete snapshots and snapshots being deleted will
121 also be listed.
122 "
123
124 groupoption "run" R
125 #~~~~~~~~~~~~~~~~~~
126 "Start creating and pruning snapshots"
127 group="command"
128 details="
129 This is the main mode of operation. Snapshots will be created
130 as needed and pruned automatically.
131 "
132
133 ###############################
134 section "Rsync-related options"
135 ###############################
136
137 option "remote-host" H
138 #~~~~~~~~~~~~~~~~~~~~~
139 "Remote host"
140 string typestr="hostname"
141 default="localhost"
142 optional
143 details="
144 If this option is given and its value differs from the local
145 host, then rsync uses ssh. Make sure there is no password
146 needed for the ssh connection. To achieve that, use public key
147 authentication for ssh and, if needed, set the remote user name
148 by using the --remote-user option.
149 "
150
151 option "remote-user" U
152 #~~~~~~~~~~~~~~~~~~~~~
153 "Remote user name (default: current user)"
154 string typestr="username"
155 optional
156 details="
157 Set this if the user running dss is different from the
158 user at the remote host when using ssh.
159 "
160
161 option "source-dir" -
162 #~~~~~~~~~~~~~~~~~~~~
163 "The data directory"
164 string typestr="dirname"
165 required
166 details="
167 The directory on the remote host from which snapshots are
168 taken. Of course, the user specified as --remote-user must
169 have read access to this directory.
170 "
171
172 option "dest-dir" -
173 #~~~~~~~~~~~~~~~~~~
174 "Snapshot dir"
175 string typestr="dirname"
176 required
177 details="
178 The destination directory on the local host where snapshots
179 will be written. This must be writable by the user who runs
180 dss.
181 "
182
183 option "rsync-option" O
184 #~~~~~~~~~~~~~~~~~~~~~~
185 "Further rsync options"
186 string typestr="option"
187 optional
188 multiple
189 details="
190 These option may be given multiple times. The arguments passed
191 to that option are passed verbatim to the rsync command.
192 "
193
194 ###################
195 section "Intervals"
196 ###################
197
198 option "unit-interval" u
199 #~~~~~~~~~~~~~~~~~~~~~~~
200 "The duration of a unit interval"
201 int typestr="days"
202 default="4"
203 optional
204 details="
205 dss snapshot aging is implemented in terms of intervals. There
206 are two command line options related to intervals: the
207 duration u of a \"unit\" interval and the number n of those
208 unit intervals.
209
210 dss removes any snapshots older than n times u and tries to
211 keep 2^(k-1) snapshots in interval k, where the interval number
212 k counts from zero, zero being the most recent unit interval.
213
214 In other words, the oldest snapshot will at most be u * n days
215 (= 20 days if default values are used) old. Moreover, there
216 are at most 2^n - 1 snapshots in total (i. e. 31 by default).
217 Observe that you have to create at least 2 ^ (n - 1) snapshots
218 each interval for this to work out because that is the number
219 of snapshots in interval zero.
220 "
221
222 option "num-intervals" n
223 #~~~~~~~~~~~~~~~~~~~~~~~
224 "The number of unit intervals"
225 int typestr="num"
226 default="5"
227 optional
228
229 ###############
230 section "Hooks"
231 ###############
232
233 option "pre-create-hook" r
234 #~~~~~~~~~~~~~~~~~~~~~~~~~~
235 "Executed before snapshot creation"
236 string typestr="command"
237 optional
238 details="
239 Execute this command before trying to create a new snapshot.
240 If this command returns with a non-zero exit status, no
241 snapshot is being created and the operation is retried later.
242
243 For example, one might want to execute a script that checks
244 whether all snapshot-related file systems are properly mounted.
245
246 Another possible application of this is to return non-zero
247 during office hours in order to not slow down the file systems
248 by taking snapshots.
249 "
250
251 option "post-create-hook" o
252 #~~~~~~~~~~~~~~~~~~~~~~~~~~
253 "Executed after snapshot creation"
254 string typestr="command"
255 optional
256 details="
257 Execute this after a snapshot has successfully been
258 created. The full path of the newly created snapshot is passed
259 to the hook as the first argument. The return value of that
260 hook is ignored.
261
262 For instance this hook can be used to count the number of
263 files per user and/or the disk usage patterns in order to
264 store them in a database for further treatment.
265 "
266
267 ###############################
268 section "Disk space monitoring"
269 ###############################
270
271 option "min-free-mb" m
272 #~~~~~~~~~~~~~~~~~~~~~
273 "Minimal amount of free disk space"
274 int typestr="megabytes"
275 default="100"
276 optional
277 details="
278 If disk space on the file system containing the destination
279 directory gets low, \"dss --run\" will suspend the currently
280 running rsync process and will start to remove snapshots in
281 order to free disk space. This option specifies the minimal
282 amount of free disk space. If less than the given number of
283 megabytes is available, snapshots are being deleted. See also
284 the --min_free_percent and the min-free-percent-inodes options.
285
286 A value of zero deactivates this check.
287 "
288
289 option "min-free-percent" p
290 #~~~~~~~~~~~~~~~~~~~~~~~~~~
291 "Minimal percent of free disk space"
292 int typestr="percent"
293 default="2"
294 optional
295 details="
296 See --min-free-mb. Note that it is not recommended to set both
297 --min-free-mb and --min-free-percent to zero as this will
298 cause your file system to fill up quickly.
299 "
300 option "min-free-percent-inodes" i
301 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
302 "Minimal percent of free inodes"
303 int typestr="percent"
304 default="0"
305 optional
306 details="
307 Specify the minimum amount of free inodes on the file system
308 containing the destination dir. If less than that many inodes
309 are free, snatshot removal kicks in just as in case of low
310 disk space.
311
312 Note that not every file system supports the concept of inodes.
313 Moreover it is not possible to reliably detect whether this is
314 the case. Therefore this feature is disabled by default. It's
315 safe to enable it for ext3 file systems on linux though.
316
317 A value of zero (the default) deactivates this check.
318 "