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