Merge commit 'meins/master'
[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.1.2"
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 it belongs to an interval
114 greater than the maximum number of intervals. It is said to be
115 redundant if it belongs to an interval that already contains
116 more than the desired number of snapshots. This command gets
117 rid of such snapshots.
118 "
119
120 groupoption "ls" L
121 #~~~~~~~~~~~~~~~~~
122 "Print a list of all snapshots"
123 group="command"
124 details="
125 The list will contain all snapshots no matter of their state,
126 i. e. incomplete snapshots and snapshots being deleted will
127 also be listed.
128 "
129
130 groupoption "run" R
131 #~~~~~~~~~~~~~~~~~~
132 "Start creating and pruning snapshots"
133 group="command"
134 details="
135 This is the main mode of operation. Snapshots will be created
136 in an endless loop as needed and pruned automatically. The loop
137 only terminates on fatal errors or if a terminating signal was
138 received. See also the --exit-hook option.
139 "
140
141 ###############################
142 section "Rsync-related options"
143 ###############################
144
145 option "remote-host" H
146 #~~~~~~~~~~~~~~~~~~~~~
147 "Remote host"
148 string typestr="hostname"
149 default="localhost"
150 optional
151 details="
152 If this option is given and its value differs from the local
153 host, then rsync uses ssh. Make sure there is no password
154 needed for the ssh connection. To achieve that, use public key
155 authentication for ssh and, if needed, set the remote user name
156 by using the --remote-user option.
157 "
158
159 option "remote-user" U
160 #~~~~~~~~~~~~~~~~~~~~~
161 "Remote user name (default: current user)"
162 string typestr="username"
163 optional
164 details="
165 Set this if the user running dss is different from the
166 user at the remote host when using ssh.
167 "
168
169 option "source-dir" -
170 #~~~~~~~~~~~~~~~~~~~~
171 "The data directory"
172 string typestr="dirname"
173 required
174 details="
175 The directory on the remote host from which snapshots are
176 taken. Of course, the user specified as --remote-user must
177 have read access to this directory.
178 "
179
180 option "dest-dir" -
181 #~~~~~~~~~~~~~~~~~~
182 "Snapshot dir"
183 string typestr="dirname"
184 required
185 details="
186 The destination directory on the local host where snapshots
187 will be written. This must be writable by the user who runs
188 dss.
189 "
190
191 option "rsync-option" O
192 #~~~~~~~~~~~~~~~~~~~~~~
193 "Further rsync options"
194 string typestr="option"
195 optional
196 multiple
197 details="
198 This option may be given multiple times. The given argument is
199 passed verbatim to the rsync command. Note that in order to use
200 rsync options that require an argument, you have to specify the
201 option and its argument as separate --rsync-options, like this:
202
203 --rsync-option --exclude --rsync-option /proc
204 "
205
206 ###################
207 section "Intervals"
208 ###################
209
210 option "unit-interval" u
211 #~~~~~~~~~~~~~~~~~~~~~~~
212 "The duration of a unit interval"
213 int typestr="days"
214 default="4"
215 optional
216 details="
217 dss snapshot aging is implemented in terms of intervals. There
218 are two command line options related to intervals: the
219 duration u of a \"unit\" interval and the number n of those
220 unit intervals.
221
222 dss removes any snapshots older than n times u and tries to
223 keep 2^(n - k - 1) snapshots in interval k, where the interval
224 number k counts from zero, zero being the most recent unit
225 interval.
226
227 In other words, the oldest snapshot will at most be u * n days
228 (= 20 days if default values are used) old. Moreover, there
229 are at most 2^n - 1 snapshots in total (i. e. 31 by default).
230 Observe that you have to create at least 2^(n - 1) snapshots
231 each interval for this to work out because that is the number
232 of snapshots in interval zero.
233 "
234
235 option "num-intervals" n
236 #~~~~~~~~~~~~~~~~~~~~~~~
237 "The number of unit intervals"
238 int typestr="num"
239 default="5"
240 optional
241
242 ###############
243 section "Hooks"
244 ###############
245
246 option "pre-create-hook" r
247 #~~~~~~~~~~~~~~~~~~~~~~~~~~
248 "Executed before snapshot creation"
249 string typestr="command"
250 optional
251 details="
252 Execute this command before trying to create a new snapshot.
253 If this command returns with a non-zero exit status, no
254 snapshot is being created and the operation is retried later.
255
256 For example, one might want to execute a script that checks
257 whether all snapshot-related file systems are properly mounted.
258
259 Another possible application of this is to return non-zero
260 during office hours in order to not slow down the file systems
261 by taking snapshots.
262 "
263
264 option "post-create-hook" o
265 #~~~~~~~~~~~~~~~~~~~~~~~~~~
266 "Executed after snapshot creation"
267 string typestr="command"
268 optional
269 details="
270 Execute this after a snapshot has successfully been
271 created. The full path of the newly created snapshot is
272 passed to the hook as the first argument. The exit code of
273 this hook is ignored.
274
275 For instance this hook can be used to count the number of
276 files per user and/or the disk usage patterns in order to
277 store them in a database for further analysis.
278 "
279
280 option "exit-hook" e
281 #~~~~~~~~~~~~~~~~~~~
282 "Executed if run command exits"
283 string typestr="command"
284 optional
285 details="
286 This hook is only used if the --run command was given which
287 instructs dss to run in an endless loop. The exit-hook gets
288 executed whenever this endless loop terminates. The reason
289 for terminating the loop is passed as the first argument.
290
291 One possible application for this hook is to send email to the
292 system administrator to let her know that no more snapshots
293 are going to be created.
294 "
295
296 ###############################
297 section "Disk space monitoring"
298 ###############################
299
300 option "min-free-mb" m
301 #~~~~~~~~~~~~~~~~~~~~~
302 "Minimal amount of free disk space"
303 int typestr="megabytes"
304 default="100"
305 optional
306 details="
307 If disk space on the file system containing the destination
308 directory gets low, \"dss --run\" will suspend the currently
309 running rsync process and will start to remove snapshots in
310 order to free disk space. This option specifies the minimal
311 amount of free disk space. If less than the given number of
312 megabytes is available, snapshots are being deleted. See also
313 the --min_free_percent and the min-free-percent-inodes options.
314
315 A value of zero deactivates this check.
316 "
317
318 option "min-free-percent" p
319 #~~~~~~~~~~~~~~~~~~~~~~~~~~
320 "Minimal percent of free disk space"
321 int typestr="percent"
322 default="2"
323 optional
324 details="
325 See --min-free-mb. Note that it is not recommended to set both
326 --min-free-mb and --min-free-percent to zero as this will
327 cause your file system to fill up quickly.
328 "
329 option "min-free-percent-inodes" i
330 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331 "Minimal percent of free inodes"
332 int typestr="percent"
333 default="0"
334 optional
335 details="
336 Specify the minimum amount of free inodes on the file system
337 containing the destination dir. If less than that many inodes
338 are free, snapshot removal kicks in just as in case of low
339 disk space.
340
341 Note that not every file system supports the concept of inodes.
342 Moreover it is not possible to reliably detect whether this is
343 the case. Therefore this feature is disabled by default. It's
344 safe to enable it for ext3 file systems on linux though.
345
346 A value of zero (the default) deactivates this check.
347 "
348
349 option "keep-redundant" k
350 #~~~~~~~~~~~~~~~~~~~~~~~~
351 "Prune by disk space only"
352 flag off
353 details="
354 If this flag is not given dss removes redundant and outdated
355 snapshots automatically.
356
357 Otherwise, this feature is deactivated so that snapshots are
358 only being removed in case disk space or number of free inodes
359 becomes low. Use this flag if the file system containing the
360 destination directory is used for snapshots only.
361 "