8a3d304d6fcef2c1c1e9bf41c2acfc539bd2824e
[dss.git] / dss.ggo
1 # Copyright (C) 2008-2010 Andre Noll <maan@tuebingen.mpg.de>
2 #
3 # Licensed under the GPL v2. For licencing details see COPYING.
4
5 package "dss"
6 version "0.1.6"
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 conjunction
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 only honored if both --run and --daemon are
82         given. Otherwise it is silently ignored and log output is
83         written to stderr.
84 "
85
86 ##################
87 section "Commands"
88 ##################
89
90 defgroup "command"
91 #=================
92 groupdesc="
93         dss supports a couple of commands each of which corresponds
94         to a different command line option. Exactly one of these
95         options must be given.
96
97 "
98 required
99
100 groupoption "create" C
101 #~~~~~~~~~~~~~~~~~~~~~
102 "Create a new snapshot"
103 group="command"
104 details="
105         Execute the rsync command to create a new snapshot. Note that
106         this command does not care about free disk space.
107 "
108
109 groupoption "prune" P
110 #~~~~~~~~~~~~~~~~~~~~
111 "Remove redundant and outdated snapshots"
112 group="command"
113 details="
114         A snapshot is considered outdated if its interval number
115         is greater or equal than the specified number of unit
116         intervals. See the \"Intervals\" section below for the precise
117         definition of these terms.
118
119         A snapshot is said to be redundant if it belongs to an
120         interval that already contains more than the desired number
121         of snapshots.
122
123         The prune command gets rid of both outdated and redundant
124         snapshots.
125 "
126
127 groupoption "ls" L
128 #~~~~~~~~~~~~~~~~~
129 "Print a list of all snapshots"
130 group="command"
131 details="
132         The list will contain all snapshots no matter of their state,
133         i. e. incomplete snapshots and snapshots being deleted will
134         also be listed.
135 "
136
137 groupoption "run" R
138 #~~~~~~~~~~~~~~~~~~
139 "Start creating and pruning snapshots"
140 group="command"
141 details="
142         This is the main mode of operation. Snapshots will be created
143         in an endless loop as needed and pruned automatically. The loop
144         only terminates on fatal errors or if a terminating signal was
145         received. See also the --exit-hook option.
146 "
147
148 groupoption "kill" K
149 #~~~~~~~~~~~~~~~~~~~
150 "Kill a running dss process"
151 group="command"
152 details="
153         This sends SIGTERM to the dss process that corresponds to the
154         given config file. If --dry-run is given, the PID of the dss
155         process is written to stdout, but no signal is sent.
156 "
157
158 groupoption "reload" -
159 #~~~~~~~~~~~~~~~~~~~~~
160 "force a running dss process to reload its config file"
161 group="command"
162 details="
163         This differs from --kill only in that SIGHUP rather than SIGTERM
164         is sent to the dss process.
165 "
166
167 ###############################
168 section "Rsync-related options"
169 ###############################
170
171 option "remote-host" H
172 #~~~~~~~~~~~~~~~~~~~~~
173 "Remote host"
174 string typestr="hostname"
175 default="localhost"
176 optional
177 details="
178         If this option is given and its value differs from the local
179         host, then rsync uses ssh. Make sure there is no password
180         needed for the ssh connection. To achieve that, use public key
181         authentication for ssh and, if needed, set the remote user name
182         by using the --remote-user option.
183 "
184
185 option "remote-user" U
186 #~~~~~~~~~~~~~~~~~~~~~
187 "Remote user name (default: current user)"
188 string typestr="username"
189 optional
190 details="
191         Set this if the user running dss is different from the
192         user at the remote host when using ssh.
193 "
194
195 option "source-dir" -
196 #~~~~~~~~~~~~~~~~~~~~
197 "The data directory"
198 string typestr="dirname"
199 required
200 details="
201         The directory on the remote host from which snapshots are
202         taken.  Of course, the user specified as --remote-user must
203         have read access to this directory.
204 "
205
206 option "dest-dir" -
207 #~~~~~~~~~~~~~~~~~~
208 "Snapshot dir"
209 string typestr="dirname"
210 required
211 details="
212         The destination directory on the local host where snapshots
213         will be written. This must be writable by the user who runs
214         dss.
215 "
216
217 option "no-resume" -
218 #~~~~~~~~~~~~~~~~~~~
219 "Do not try to resume from previous runs"
220 flag off
221 details = "
222         Starting from version 0.1.4, dss tries to resume from a
223         previously cancelled dss instance by default. It does so by
224         looking at the status of the most recently created snapshot. If
225         this snapshot status is incomplete, its directory is reused
226         as the destination directory for a subsequent rsync run.
227
228         The --no-resume option deactivates this feature so that a new
229         directory is always used as the rsync destination directory.
230 "
231
232 option "rsync-option" O
233 #~~~~~~~~~~~~~~~~~~~~~~
234 "Further rsync options"
235 string typestr="option"
236 optional
237 multiple
238 details="
239         This option may be given multiple times. The given argument is
240         passed verbatim to the rsync command. Note that in order to use
241         rsync options that require an argument, you have to specify the
242         option and its argument as separate --rsync-options, like this:
243
244                 --rsync-option --exclude --rsync-option /proc
245 "
246
247 option "max-rsync-errors" -
248 "Terminate after this many rsync failures"
249 int typestr="count"
250 default="10"
251 optional
252 details="
253         Only relevant when operating in --run mode (see above). If
254         the rsync process exits with a fatal error, dss restarts
255         the command in the hope that the problem is transient
256         and subsequent rsync runs succeed. After the given number
257         of consecutive rsync error exits, however, dss gives up,
258         executes the exit hook and terminates. Set this to zero if
259         dss should exit immediately on the first rsync error.
260
261         The only non-fatal error is when rsync exits with code 24. This
262         indicates a partial transfer due to vanished source files
263         and happens frequently when snapshotting a directory which
264         is concurrently being modified.
265 "
266
267 ###################
268 section "Intervals"
269 ###################
270
271 option "unit-interval" u
272 #~~~~~~~~~~~~~~~~~~~~~~~
273 "The duration of a unit interval"
274 int typestr="days"
275 default="4"
276 optional
277 details="
278         Snapshot aging is implemented in terms of intervals. There are two
279         command line options related to intervals: the duration u of a unit
280         interval and the number of unit intervals, denoted n below.
281
282         dss removes snapshots older than n times u and tries to keep 2^(n -
283         k - 1) snapshots in interval k, where the interval number k counts
284         from zero to n - 1, with zero being the most recent unit interval.
285
286         Hence the oldest snapshot will at most be u * n days old (4 days *
287         5 intervals = 20 days, if default values are used). Moreover, there
288         are at most 2^n - 1 snapshots in total (2^5 - 1 = 31 by default). Note
289         that for this to work out your system must be fast enough to create at
290         least 2^(n - 1) snapshots per unit interval (16 snapshots in 4 days =
291         one snapshot in 6 hours), because this is the number of snapshots in
292         interval zero.
293 "
294
295 option "num-intervals" n
296 #~~~~~~~~~~~~~~~~~~~~~~~
297 "The number of unit intervals"
298 int typestr="num"
299 default="5"
300 optional
301 details="
302         Note that increasing this number by one doubles the total number of
303         snapshots. See the documentation of --unit-interval above.
304 "
305
306 ###############
307 section "Hooks"
308 ###############
309
310 option "pre-create-hook" r
311 #~~~~~~~~~~~~~~~~~~~~~~~~~~
312 "Executed before snapshot creation"
313 string typestr="command"
314 default = "true"
315 optional
316 details="
317         Execute this command before trying to create a new snapshot.
318         If this command returns with a non-zero exit status, no
319         snapshot is being created and the operation is retried later.
320
321         For example, one might want to execute a script that checks
322         whether all snapshot-related file systems are properly mounted.
323
324         Another possible application of this is to return non-zero
325         during office hours in order to not slow down the file systems
326         by taking snapshots.
327 "
328
329 option "post-create-hook" o
330 #~~~~~~~~~~~~~~~~~~~~~~~~~~
331 "Executed after snapshot creation"
332 string typestr="command"
333 default = "true"
334 optional
335 details="
336         Execute this after a snapshot has successfully been
337         created. The full path of the newly created snapshot is
338         passed to the hook as the first argument.  The exit code of
339         this hook is ignored.
340
341         For instance this hook can be used to count the number of
342         files per user and/or the disk usage patterns in order to
343         store them in a database for further analysis.
344 "
345
346 option "pre-remove-hook" -
347 #~~~~~~~~~~~~~~~~~~~~~~~~~~
348 "Executed before snapshot removal"
349 string typestr="command"
350 default = "true"
351 optional
352 details="
353         Execute this command before removing a snapshot. The full
354         path to the snapshot about to be deleted is passed to the
355         command as the first argument. If the command returns with
356         a non-zero exit status, no snapshot is being removed and the
357         operation is retried later.
358
359         For example, one might want to execute a script that checks
360         whether the snapshot to be deleted is currently used by
361         another process, e.g. by a tape-based backup system that runs
362         concurrently to dss.
363
364         Another possible application of this is to record disk-usage
365         patterns before and after snapshot removal.
366 "
367
368 option "post-remove-hook" -
369 #~~~~~~~~~~~~~~~~~~~~~~~~~~
370 "Executed after snapshot removal"
371 string typestr="command"
372 default = "true"
373 optional
374 details="
375         Execute this after a snapshot has successfully been removed. As
376         for the pre-remove hook, the full path of the removed snapshot
377         is passed to the hook as the first argument. The exit code
378         of this hook is ignored.
379 "
380
381 option "exit-hook" e
382 #~~~~~~~~~~~~~~~~~~~
383 "Executed if run command exits"
384 string typestr="command"
385 default = "true"
386 optional
387 details="
388         This hook is only used if the --run command was given which
389         instructs dss to run in an endless loop. The exit-hook gets
390         executed whenever this endless loop terminates. The reason
391         for terminating the loop is passed as the first argument.
392
393         One possible application for this hook is to send email to the
394         system administrator to let her know that no more snapshots
395         are going to be created.
396 "
397
398 ###############################
399 section "Disk space monitoring"
400 ###############################
401
402 option "min-free-mb" m
403 #~~~~~~~~~~~~~~~~~~~~~
404 "Minimal amount of free disk space"
405 int typestr="megabytes"
406 default="100"
407 optional
408 details="
409         If disk space on the file system containing the destination
410         directory gets low, \"dss --run\" will suspend the currently
411         running rsync process and will start to remove snapshots in
412         order to free disk space. This option specifies the minimal
413         amount of free disk space. If less than the given number of
414         megabytes is available, snapshots are being deleted. See also
415         the --min_free_percent and the min-free-percent-inodes options.
416
417         A value of zero deactivates this check.
418 "
419
420 option "min-free-percent" p
421 #~~~~~~~~~~~~~~~~~~~~~~~~~~
422 "Minimal percent of free disk space"
423 int typestr="percent"
424 default="2"
425 optional
426 details="
427         See --min-free-mb. Note that it is not recommended to set both
428         --min-free-mb and --min-free-percent to zero as this will
429         cause your file system to fill up quickly.
430 "
431 option "min-free-percent-inodes" i
432 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
433 "Minimal percent of free inodes"
434 int typestr="percent"
435 default="0"
436 optional
437 details="
438         Specify the minimum amount of free inodes on the file system
439         containing the destination dir. If less than that many inodes
440         are free, snapshot removal kicks in just as in case of low
441         disk space.
442
443         Note that not every file system supports the concept of inodes.
444         Moreover it is not possible to reliably detect whether this is
445         the case. Therefore this feature is disabled by default. It's
446         safe to enable it for ext2/ext3/ext4 file systems on linux
447         though.
448
449         A value of zero (the default) deactivates this check.
450 "
451
452 option "keep-redundant" k
453 #~~~~~~~~~~~~~~~~~~~~~~~~
454 "Prune by disk space only"
455 flag off
456 details="
457         If this flag is not given dss removes redundant and outdated
458         snapshots automatically.
459
460         Otherwise, this feature is deactivated so that snapshots are
461         only being removed in case disk space or number of free inodes
462         becomes low. Use this flag if the file system containing the
463         destination directory is used for snapshots only.
464 "
465
466 option "min-complete" -
467 #~~~~~~~~~~~~~~~~~~~~~~
468 "Minimal number of complete snapshots to keep"
469 int typestr = "num"
470 default = "1"
471 optional
472 details = "
473         This option is only relevant if snapshots must be deleted
474         because disk space gets low.
475
476         dss refuses to remove old snapshots if there are fewer complete
477         snapshots left than the given number. The default value of one
478         guarantees that at least one complete snapshot is available
479         at all times.
480
481         If only <num> complete snapshot are left, and there is not
482         enough disk space available for another snapshot, the program
483         terminates with a \"No space left on device\" error.
484 "