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