Fix a serious bug in deamon mode.
[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 option "exclude-patterns" e
192 #~~~~~~~~~~~~~~~~~~~~~~~~~~
193 "Rsync exclude patterns"
194 string typestr="path"
195 optional
196
197 ###################
198 section "Intervals"
199 ###################
200
201 option "unit-interval" u
202 #~~~~~~~~~~~~~~~~~~~~~~~
203 "The duration of a unit interval"
204 int typestr="days"
205 default="4"
206 optional
207 details="
208         dss snapshot aging is implemented in terms of intervals. There
209         are two command line options related to intervals: the
210         duration u of a \"unit\" interval and the number n of those
211         unit intervals.
212
213         dss removes any snapshots older than n times u and tries to
214         keep 2^(k-1) snapshots in interval k, where the interval number
215         k counts from zero, zero being the most recent unit interval.
216
217         In other words, the oldest snapshot will at most be u * n days
218         (= 20 days if default values are used) old.  Moreover, there
219         are at most 2^n - 1 snapshots in total (i. e. 31 by default).
220         Observe that you have to create at least 2 ^ (n - 1) snapshots
221         each interval for this to work out because that is the number
222         of snapshots in interval zero.
223 "
224
225 option "num-intervals" n
226 #~~~~~~~~~~~~~~~~~~~~~~~
227 "The number of unit intervals"
228 int typestr="num"
229 default="5"
230 optional
231
232 ###############
233 section "Hooks"
234 ###############
235
236 option "pre-create-hook" r
237 #~~~~~~~~~~~~~~~~~~~~~~~~~~
238 "Executed before snapshot creation"
239 string typestr="command"
240 optional
241 details="
242         Execute this command before trying to create a new snapshot.
243         If this command returns with a non-zero exit status, no
244         snapshot is being created and the operation is retried later.
245
246         For example, one might want to execute a script that checks
247         whether all snapshot-related file systems are properly mounted.
248
249         Another possible application of this is to return non-zero
250         during office hours in order to not slow down the file systems
251         by taking snapshots.
252 "
253
254 option "post-create-hook" o
255 #~~~~~~~~~~~~~~~~~~~~~~~~~~
256 "Executed after snapshot creation"
257 string typestr="command"
258 optional
259 details="
260         Execute this after a snapshot has successfully been
261         created. The full path of the newly created snapshot is passed
262         to the hook as the first argument.  The return value of that
263         hook is ignored.
264
265         For instance this hook can be used to count the number of
266         files per user and/or the disk usage patterns in order to
267         store them in a database for further treatment.
268 "
269
270 ###############################
271 section "Disk space monitoring"
272 ###############################
273
274 option "min-free-mb" m
275 #~~~~~~~~~~~~~~~~~~~~~
276 "Minimal amount of free disk space"
277 int typestr="megabytes"
278 default="100"
279 optional
280 details="
281         If disk space on the file system containing the destination
282         directory gets low, \"dss --run\" will suspend the currently
283         running rsync process and will start to remove snapshots in
284         order to free disk space. This option specifies the minimal
285         amount of free disk space. If less than the given number of
286         megabytes is available, snapshots are being deleted. See also
287         the --min_free_percent and the min-free-percent-inodes options.
288
289         A value of zero deactivates this check.
290 "
291
292 option "min-free-percent" p
293 #~~~~~~~~~~~~~~~~~~~~~~~~~~
294 "Minimal percent of free disk space"
295 int typestr="percent"
296 default="2"
297 optional
298 details="
299         See --min-free-mb. Note that it is not recommended to set both
300         --min-free-mb and --min-free-percent to zero as this will
301         cause your file system to fill up quickly.
302 "
303 option "min-free-percent-inodes" i
304 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
305 "Minimal percent of free inodes"
306 int typestr="percent"
307 default="0"
308 optional
309 details="
310         Specify the minimum amount of free inodes on the file system
311         containing the destination dir. If less than that many inodes
312         are free, snatshot removal kicks in just as in case of low
313         disk space.
314
315         Note that not every file system supports the concept of inodes.
316         Moreover it is not possible to reliably detect whether this is
317         the case. Therefore this feature is disabled by default. It's
318         safe to enable it for ext3 file systems on linux though.
319
320         A value of zero (the default) deactivates this check.
321 "