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