summaryrefslogtreecommitdiff
path: root/doc/rsbackup.5
blob: bd02d7415fce097f216985b487f09cf50d3ea509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
.TH rsbackup 5
.\" Copyright (c) 2011, 2012, 2014-18 Richard Kettlewell
.\"
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>.
.SH NAME
/etc/rsbackup/config \- configuration for rsync-based backup utility
.SH DESCRIPTION
This describes the configuration file syntax for for \fBrsbackup\fR(1).
.SH "SYNTAX"
.SS "Line Splitting"
Line are split into space-separated words.
To include spaces in a word, quote it using "double quotes".
Quotes and backslashes within quoted strings are escaped with
backslashes (and cannot appear in an unquoted word).
.SS "Comments and Blank Lines"
Anything after the first (unquoted) "#" to appear on a line is
ignored.
.PP
Lines with no words on (whether they are completely empty, or contain
just spaces, or have a "#" before any non-space characters) are
ignored (and do not have to follow the indentation rules below).
.SS "Directives and Stanzas"
The first word of a line is called a directive.
The remaining words if any form its arguments.
.PP
A stanza consists of a directive introducing the stanza followed by
zero or more directives within the stanza.
These must be indented, consistently, relative to the directive that
introduced the stanza.
.PP
A configuration file contains global directives (which must not be
indented) and one or more host stanzas.
Each host stanza contains one or more volume stanzas.
.PP
Global directives may appear after host stanzas (and host directives
after volume stanzas) provided they are indented correctly.
.SH "GLOBAL DIRECTIVES"
Global directives control some general aspect of the program.
.TP
.B device \fIDEVICE\fR
Names a device.
This can be used multiple times.
The store must have a file called \fISTORE\fB/device\-id\fR which
contains a known device name.
Backups will only be
made to known devices.
.IP
When a device is lost or destroyed, remove its device entry and use the
\-\-prune\-unknown option to delete records of backups on it.
.IP
Device names may contain letters, digits, dots and underscores.
.TP
.B include \fIPATH\fR
Include another file as part of the configuration.
If \fIPATH\fR is a directory then the files within it are included
(excluding dotfiles, backup and recovery files).
.TP
.B keep\-prune\-logs \fIDAYS\fR
The number of days to keep records of pruned backups for.
The default is 31.
.TP
.B lock \fIPATH\fR
Enable locking.
If this directive is present then \fIPATH\fR will be used as a lockfile
for operations that change anything (\-\-backup, \-\-prune, etc).
.IP
The lock is made by opening \fIPATH\fR and calling \fBflock\fR(2) on
it with \fBLOCK_EX\fR.
.TP
.B logs \fIPATH\fR
The directory to store logfiles and backup records.
The default is \fI/var/log/backup\fR.
.TP
.B post\-access\-hook \fICOMMAND\fR...
A command to execute after all backup and prune operations.
This is executed only once per invocation of \fBrsbackup\fR.
A backup is still considered to have succeeded even if the post-access
hook fails (i.e. exits nonzero).
See \fBHOOKS\fR below.
.TP
.B pre\-access\-hook \fICOMMAND\fR...
A command to execute before anything that accesses any backup devices
(i.e. backup and prune operations).
This is executed only once per invocation of \fBrsbackup\fR and if it
fails (i.e. exits nonzero) then \fBrsbackup\fR terminates immediately.
See \fBHOOKS\fR below.
.TP
.B public true\fR|\fBfalse
If true, backups are public.
Normally backups must only be accessible by the calling user.
This option suppresses the check.
.TP
.B store \fIPATH\fR
A path at which a backup device may be mounted.
This can be used multiple times.
.TP
.B store\-pattern \fIPATTERN\fR
A \fBglob\fR(7) pattern matching paths at which a backup device may be
mounted.
This can be used multiple times.
.SS "Report Directives"
These are global directives that affect only the HTML report.
.TP
.B colors \fIGOOD \fIBAD
The colors used to represent good states (a recent backup) and bad
states (no sufficiently recent backup).
.IP
\fIGOOD\fR and \fIBAD\fR are integer values representing RGB triples.
It is most convenient to write them in hex, e.g. as \fB0x\fIRRGGBB\fR.
For example, black is \fB0x000000\fR, red is \fB0xFF0000\fR, and so
on.
.IP
This directive is deprecated.
Use \fBcolor\-bad\fR and \fBcolor\-good\fR instead.
.TP
.B color\-bad \fICOLOR
The color used to represent bad states (no sufficiently recent backup)
in the report.
See below for the interpretation of \fICOLOR\fR.
.TP
.B color\-good \fICOLOR
The color used to represent good states (a recent backup) in the report.
.TP
.B report \fR[\fB+\fR] \fR[\fIKEY\fR][\fB:\fIVALUE\fR][\fB?\fICONDITION\fR] ...
Defines the report contents.
The arguments to this directive are a sequence of keys, optionally parameterized by a value and/or a condition.
.IP
If the first argument is a \fB+\fR then the arguments are added to the current configuration; otherwise they replace it.
.IP
The possible keys, with values where appropriate, are:
.RS
.TP
.B generated
A timestamp stating when the report was generated.
.TP
.B history\-graph
A graphic showing the backups available for each volume.
This only works if \fBrsbackup\-graph\fR(1) is installed.
.TP
.B h1:\fIHEADING
.TP
.B h2:\fIHEADING
.TP
.B h3:\fIHEADING
Headings at levels 1, 2 and 3.
.TP
.B logs
A list of logs of failed backups.
.TP
.B p:\fIPARAGRAPH
A paragraph of text.
.TP
.B prune\-logs\fR[\fB:\fIDAYS\fR]
A list of logs of pruned backups.
.IP
\fIDAYS\fR is the number of days of pruning logs to put in the report.
The default is 3.
.TP
.B summary
A table summarizing the backups available for each volume.
.TP
.B title:\fITITLE
The document title.
.TP
.B warnings
A list of warning messages.
.PP
If a condition is specified then the key is only used if the condition is true.
The possible conditions are:
.TP
.B warnings
True if there are any warnings to display (i.e. if the \fBwarnings\fR
key is nonempty).
.PP
Within a \fIVALUE\fR the following sequences undergo substitution:
.TP
.B \e\fICHAR
Replaced with the single character \fICHAR\fR.
.TP
.B ${\fIVARIABLE\fB}
Replaced with the value of the environment variable \fIVARIABLE\fR, if
it is set.
.PP
The following environment variables are set:
.TP
.B RSBACKUP_CTIME
The local date and time in \fBctime\fR(3) format.
.TP
.B RSBACKUP_DATE
The local date in YYYY\-MM\-DD format.
.PP
The default is equivalent to:
.PP
.RS
.nf
report "title:Backup report (${RSBACKUP_DATE})"
report "h1:Backup report (${RSBACKUP_DATE})"
report + h2:Warnings?warnings warnings
report + "h2:Summary" summary
report + history\-graph
report + h2:Logfiles logs
report + "h3:Pruning logs" prune\-logs
report + "p:Generated ${RSBACKUP_CTIME}"
.fi
.RE
.RE
.TP
.B report\-prune\-logs \fIDAYS\fR
Overrides the number of days of pruning logs to put in the report.
.IP
This directive is deprecated.
Use \fBreport\fR instead.
.TP
.B sendmail \fIPATH\fR
The path to the executable to use for sending email.
The default is platform-dependent but typically \fI/usr/sbin/sendmail\fR.
The executable should support the \fB\-t\fR, \fB\-oee\fR, \fB\-oi\fR and
\fB\-odb\fR options.
.TP
.B stylesheet \fIPATH
The path to the stylesheet to use in the HTML report.
If this is absent then a built-in default stylesheet is used.
.SS "Graph Directives"
These are global directives that affect the output of \fBrsbackup\-graph\fR(1).
.TP
.B color\-graph\-background \fICOLOR
The background color.
See below for the interpretation of \fICOLOR\fR.
.TP
.B color\-graph\-foreground \fICOLOR
The foreground color, i.e. for text.
.TP
.B color\-month\-guide \fICOLOR
The color for the vertical month guides.
.TP
.B color\-host\-guide \fICOLOR
The color for the horizontal guides between hosts.
.TP
.B color\-volume\-guide \fICOLOR
The color for the horizontal guides between volumes.
.TP
.B device\-color\-strategy \fISTRATEGY
The strategy to use for picking device colors.
.IP
A strategy is a name and a sequence of parameters, all of which are optional.
.IP
The possible strategies are:
.RS
.TP
.B equidistant\-value \fIHUE SATURATION MINVALUE MAXVALUE
Colors are picked with chosen hue and saturation, with values equally spaced within a range.
.IP
The default hue is 0 and the default saturation is 1.
The default value range is from 0 to 1.
.TP
.B equidistant\-hue \fIHUE SATURATION VALUE
Colors are picked with chosen saturation and value and equally spaced hues,
starting from \fIHUE\fR.
.IP
The default starting hue is 0 and the default saturation and value are 1.
.PP
The default strategy is equivalent to:
.RS
.nf

device\-color\-strategy equidistant\-value 120 0.75
.fi
.RE
.RE
.TP
.B horizontal\-padding \fIPIXELS
The number pixels to place between horizontally adjacent elements.
The default is 8.
.TP
.B vertical\-padding \fIPIXELS
The number pixels to place between vertically adjacent elements.
The default is 2.
.TP
.B host\-name\-font \fIFONT
The font description used for host names.
See below for the interpretation of \fIFONT\fR.
.TP
.B volume\-name\-font \fIFONT
The font description used for volume names.
.TP
.B device\-name\-font \fIFONT
The font description used for device names.
.TP
.B time\-label\-font \fIFONT
The font description used for time labels.
.TP
.B graph\-layout \fR[\fB+\fR] \fR\fIPART\fR\fB:\fICOLUMN\fB,\fIROW\fR[\fB:\fIHV\fR] ...
.RS
Defines the graph layout.
.PP
The arguments to this directive are a sequence of graph component
specifications of the form
\fIPART\fR\fB:\fICOLUMN\fB,\fIROW\fR[\fB:\fIHV\fR], where:
.TP
.I PART
The name of this component.
The following parts are recognized:
.RS
.TP
.B host\-labels
The host name labels for the graph.
This is expected to be in the same row as \fBcontent\fR.
.TP
.B volume\-labels
The volume name labels for the graph.
This is expected to be in the same row as \fBcontent\fR.
.TP
.B content
The graph content.
.TP
.B time\-labels
The time labels for the graph.
This is expected to be in the same column as \fBcontent\fR.
.TP
.B device\-key
The key mapping device names to colors.
.RE
.TP
.I COLUMN
The column number for this component.
0 is the leftmost column.
.TP
.I ROW
The row number for this component.
0 is the top row.
.TP
.I HV
The (optional) justification specification for this component.
.I H
may be one of the following:
.RS
.TP
.B L
Left justification.
.TP
.B C
Centre justification.
.TP
.B R
Right justification.
.PP
.I V
may be one of the following:
.TP
.B T
Top justification.
.TP
.B C
Centre justification.
.TP
.B B
Bottom justification.
.RE
.PP
Parts may be repeated or omitted.
.PP
The default layout is equivalent to:
.PP
.RS
.nf
graph\-layout host\-labels:0,0
graph\-layout + volume\-labels:1,0
graph\-layout + content:2,0
graph\-layout + time\-labels:2,1
graph\-layout + device\-key:2,3:RC
.fi
.RE
.RE
.SS Colors
\fICOLOR\fR may be one of the following:
.TP
.I DECIMAL\fR or \fB0x\fIRRGGBB
An integer value representing an RGB triple.
It is most convenient to use hexadecimal.
For example, black is \fB0x000000\fR, red is \fB0xFF0000\fR, and so
on.
.TP
.B rgb \fIRED GREEN BLUE
Three numbers in the range 0 to 1 representing red, green and blue components.
.TP
.B hsv \fIHUE SATURATION VALUE
\fIHUE\fR chooses between different primary colors and mixtures of them.
0 represents red, 120 represents green and 240 represents blue;
intermediate values represent mixed hues.
.IP
Normally it would be in the range 0 <= \fIHUE\fR < 360, but values outside this
range are mapped into it.
.IP
\fISATURATION\fR is a number in the
range 0 to 1 and (roughly) represents how colorful the color is.
0 is a shade of grey and 1 is maximally colorful.
.IP
\fIVALUE\fR is a number in the range 0 to 1 and
represents the brightness of the color.
.IP
See https://en.wikipedia.org/wiki/HSL_and_HSV for a fuller discussion
of these terms.
.SS Fonts
\fIFONT\fR is a Pango font description.
The syntax is "[\fIFAMILY-LIST\fR] [\fISTYLE-OPTIONS\fR] [\fISIZE\fR]" where:
.TP
.I FAMILY-LIST
A comma-separate list of font families.
These necessarily depend on the fonts installed locally but Pango
recognizes \fBmonospace\fR, \fBsans\fR and and \fBserif\fR as generic
family names.
.IP
If you have \fBtexttopng\fR(1) then \fBtexttopng \-l\fR will generate a
list of fonts recognized by your Pango install.
See  http://www.greenend.org.uk/rjk/sw/texttools/ for download.
.TP
.I STYLE-OPTIONS
A whitespace-separated list of style, variant, weight, stretch and
gravity options.
.IP
The possible style options are \fBroman\fR (the default),
\fBoblique\fR and \fBitalic\fB.
.IP
The possible variant options are \fBsmall\-caps\fR.
.IP
The possible weight options are \fBthin\fB, \fBultra\-light\fR,
\fBlight\fR, \fBsemi\-light\fB, \fBbook\fR, \fBregular\fR (the
default), \fBmedium\fR, \fBsemi\-bold\fR, \fBbold\fR, \fBultra\-bold\fR,
\fBheavy\fR and \fBultra\-heavy\fR.
.IP
The possible stretch options are \fBultra\-condensed\fR,
\fBcondensed\fR, \fBsemi\-condensed\fR, \fBsemi\-expanded\fR,
\fBexpanded\fR and \fBultra\-expanded\fR.
.IP
The possible gravity options are \fBsouth\fR (the default),
\fBnorth\fR, \fBeast\fR and \fBwest\fR.
.TP
.I SIZE
The font size in points, or \fIPIXELS\fR\fBpx\fR for a font size in pixels.
.PP
The details of the syntax are entirely under the control of the Pango
library; for full details you must consult its documentation or source
code.
.SH "INHERITABLE DIRECTIVES"
Inheritable directives control an aspect of one or more backups.
They can be specified at the global level or in a \fBhost\fR or
\fBvolume\fR stanza (see below).
If one appears in multiple places then volume settings override host
settings and host settings override global settings.
.TP
.B hook\-timeout \fISECONDS
How long to wait before concluding a hook has hung, in seconds.
The default is 0, which means to wait indefinitely.
.TP
.B host\-check always-up
Assume that the host is always up.
.TP
.B host\-check ssh
Check whether the host is up using SSH.
This is the default host check behavior.
.TP
.B host\-check command \fICOMMAND\fR...
Check whether the host is up by executing a command.
The name of the host will be appended to the command line.
If it exits with status 0 the host is assumed to be up.
If it exits with nonzero status the host is assumed to be down.
.TP
.B max\-age \fIDAYS\fR
The maximum age of the most recent backup before you feel uncomfortable.
The default is 3, meaning that if a volume hasn't been backed up in
the last 3 days it will have red ink in the HTML report.
.TP
.B min\-backups \fICOUNT\fR
The minimum number of backups for each volume to keep on each store,
when pruning.
The default is 1.
.IP
This directive is deprecated.
Use \fBprune\-parameter min\-backups\fR instead.
.TP
.B post\-backup\-hook \fICOMMAND\fR...
A command to execute after finishing a backup, or after it failed.
A backup is still considered to have succeeded even if the post-backup
hook fails (exits nonzero).
See \fBHOOKS\fR below.
.TP
.B pre\-backup\-hook \fICOMMAND\fR...
A command to execute before starting a backup.
If this hook fails (i.e. exits nonzero) then the backup is not made
and the post-backup hook will not be run.
See \fBHOOKS\fR below.
.IP
This hook can override the source path for the backup by writing a new
source path to standard output.
.TP
.B prune\-age \fIDAYS\fR
The age at which a backup may be pruned.
The default is 366, meaning a backup will never be pruned until it is
at least a whole year old.
.IP
This directive is deprecated.
Use \fBprune\-parameter prune\-age\fR instead.
.TP
.B prune\-parameter \fINAME\fR \fIVALUE\fR
Set a parameter for the pruning policy.
See \fBPRUNING\fR below.
.TP
.B prune\-parameter \-\-remove \fINAME\fR
Remove a parameter for pruning policy.
.TP
.B prune\-policy \fINAME\fR
The pruning policy to use.
See \fBPRUNING\fR below.
.TP
.B rsync\-timeout \fISECONDS
How long to wait before concluding rsync has hung, in seconds.
The default is 0, which means to wait indefinitely.
.TP
.B rsync\-command \fICOMMAND
The command to execute to make a backup.
The default is \fBrsync\fR.
.TP
.B rsync\-base\-options \fIOPTIONS \fR...
The options to supply to the rsync command.
The default is \fB--archive --sparse --numeric-ids --compress --fuzzy --hard-links --delete\fR.
.TP
.B rsync\-extra\-options \fIOPTIONS \fR...
Additional options to supply to the rsync command.
The default is \fB--xattrs --acls\fR.
.IP
See \fBPLATFORMS\fR for how to set this option when backing up macOS
or Windows platforms.
.TP
.B ssh\-timeout \fISECONDS\fR
How long to wait before concluding a host is down, in seconds.
The default is 60.
.SH "HOST DIRECTIVES"
A host stanza is started by a \fBhost\fR directive.
.TP
.B host \fIHOST\fR
Introduce a host stanza.
The name is used for the backup directory for this host.
.PP
The following directives, and \fBvolume\fR stanzas (see below), can
appear in a host stanza:
.TP
.B always\-up true\fR|\fBfalse
If true, the host is expected to always be available.
If it is not then a warning will be issued when making a backup if it is not.
Failed attempts to make a backup will also be recorded as failures for
always-up hosts (normally hosts that cannot be reached are silently
skipped).
.IP
This directive is deprecated.
Use \fBhost\-check always\-up\fR instead.
.TP
.B devices \fIPATTERN\fR
A \fBglob\fR(3) pattern restricting the devices that this host will be
backed up to.
.IP
Note that only backup creation honors this restriction.
Pruning and retiring do not.
.TP
.B hostname \fIHOSTNAME\fR
The SSH hostname for this host.
The default is the name from the host stanza.
.IP
The hostname \fBlocalhost\fR is treated specially: it is assumed to always be
identical to the local system, so files will be read from the local filesystem.
.TP
.B priority \fIINTEGER\fR
The priority of this host.
Hosts are backed up in descending priority order.
The default priority is 0.
.TP
.B user \fIUSERNAME\fR
The SSH username for this host.
The default is not to supply a username.
.PP
In addition, inheritable directives can appear in a host stanza, and
override any appearance of them at the global level.
.PP
Conventionally the contents of a host stanza are indented.
.PP
Remote hosts are accessed by SSH.
The user \fBrsbackup\fR runs as must be able to connect to the remote
host (and without a password being entered if it is to be run from a
cron job or similar).
.SH "VOLUME DIRECTIVES"
A volume stanza is started by a \fBvolume\fR directive.
It can only appear within a host stanza.
.TP
.B volume \fIVOLUME PATH\fR
Introduce a volume stanza.
The name is used for the backup directory for this volume.
The path is the absolute path on the host.
.PP
The following directives can appear in a volume stanza:
.TP
.B check\-file \fIPATH\fR
Checks that \fIPATH\fR exists before backing up the volume.
\fIPATH\fR may be either an absolute path or a relative path (to the
root of the volume).
It need not be inside the volume though the usual use would be to
check for a file which is always present there.
.IP
This check is done before executing the \fBpre\-backup\-hook\fR, so it
applies to the real path to the volume, not the rewritten path.
.TP
.B check\-mounted true\fR|\fBfalse
If true, checks that the volume's path is a mount point before backing up the
volume.
.IP
This check is done before executing the \fBpre\-backup\-hook\fR, so it
applies to the real path to the volume, not the rewritten path.
.IP
Note that if multiple \fBcheck\-\fR options are used, all checks must
pass for the volume to be backed up.
.TP
.B exclude \fIPATTERN\fR
An exclusion for this volume.
The pattern is passed to the rsync \fB\-\-exclude\fR option.
This directive may appear multiple times per volume.
.IP
See the rsync man page for full details.
.TP
.B traverse true\fR|\fBfalse
If true, traverse mount points.
This suppresses the rsync \fB\-\-one\-file\-system\fR option.
.PP
In addition, inheritable directives can appear in a volume stanza, and
override any appearance of them at the host or global level.
.PP
Conventionally the contents of a volume stanza are indented.
.SH PRUNING
This is process of removing old backups (using the \fB\-\-prune\fR option).
The pruning policy used to determine which backups to remove is set
with the inheritable \fBprune\-policy\fR directive, and parameters to
the policy set via the \fBprune\-parameter\fR directive.
.PP
The available policies are listed below.
The default policy is \fBage\fR.
.SS age
This policy deletes backups older than a minimum age, provided a
minimum number of backups on a device remain available.
The following pruning parameters are supported:
.TP
.B min\-backups
The minimum number of backups of the volume to maintain on the device.
Pruning will never cause the number of backups to fall below this value.
The default (and minimum) is 1.
.TP
.B prune\-age
The age after backups become eligible for pruning, in days.
Only backups more than this many days old will be pruned.
The default is 366 and the minimum is 1.
.PP
For backwards compatibility, these values can also be set using
the directives of the same name.
This will be disabled in a future version.
.SS decay
This policy thins out backups older than a minimum age, using a
configurable decay pattern that arranges to keep a declining number of
backups with age.
The following pruning parameters are supported:
.TP
.B decay\-start
The age after backups become eligible for pruning, in days.
Only backups more than this many days old will be pruned.
The default is 1 and the minimum is 1.
.TP
.B decay\-limit
The age after which backups are always pruned, in days.
Backups older than this will always be pruned unless this would leave
no backups at all.
The default is 366 and the minimum is 1.
.TP
.B decay\-scale
The scale at which the decay window is expanded.
The default is 2 and the minimum is 2.
.TP
.B decay\-window
The size of the decay window.
The default is 1 and the minimum is 1.
.SS exec
This policy executes a subprogram with parameters and additional
information supplied in the environment.
.PP
The following parameters are supported:
.TP
.B path
The path to the subprogram to execute.
.PP
Any additional parameters are supplied to the subprogram via
environment variables, prefixed with \fBPRUNE_\fR.
Additionally the following environment variables are set:
.TP
.B PRUNE_DEVICE
The name of the device containing the backup.
.TP
.B PRUNE_HOST
The name of the host.
.TP
.B PRUNE_ONDEVICE
The list of backups on the device, by age in days.
This list excludes any that have already been scheduled for pruning,
and includes the backup under consideration (i.e. the value of
\fBBACKUP_AGE\fR will appear in this list).
.TP
.B PRUNE_TOTAL
The total number of backups of this volume on any device.
Note that it does not include backups on other devices that have just
been selected for pruning by another call to the subprogram.
.TP
.B PRUNE_VOLUME
The name of the volume.
.PP
These environment variables all override any parameters with clashing
names.
.PP
The output should be a list of backups to prune, one per line (in any order).
Each line should contain the age in days of the backup to prune
(i.e. the same value as appeared in \fBPRUNE_ONDEVICE\fR), followed by
a colon, followed by the reason that this backup is to be pruned.
.PP
As a convenience, if the argument to \fBprune\-policy\fR starts with
\fB/\fR then the \fBexec\fR policy is chosen with the policy name as
the \fBpath\fR parameter.
.SS never
This policy never deletes any backups.
.SH HOOKS
A hook is a command executed by \fBrsbackup\fR just before or just
after some action.
The command is passed directly to \fBexecvp\fR(3); to use a shell
command, therefore, either wrap it in a script or invoke the shell
with the \fB\-c\fR option.
.PP
All hooks are run in \fB\-\-dry\-run\fR mode.
Hook scripts must honor \fBRSBACKUP_ACT\fR which will be set to
\fBfalse\fR in this mode and \fBtrue\fR otherwise.
.SS "Access Hooks"
Access hooks are executed (once) before doing anything that will
access backup devices (even just to read them).
.PP
The following environment variables are set when an access hook is executed:
.TP
.B RSBACKUP_ACT
Set to \fBfalse\fR in \fB\-\-dry\-run\fR mode and \fBtrue\fR
otherwise.
.TP
.B RSBACKUP_DEVICES
A space-separated list of known device names.
.TP
.B RSBACKUP_HOOK
The name of the hook (i.e. \fBpre\-access\-hook\fR, etc).
This allows a single hook script to serve as the implementation for
multiple hooks.
.SS "Backup Hooks"
Backup hooks are executed just before or just after a backup is
made.
Possible uses for backup hooks include snapshotting volumes or mounting volumes.
.PP
The following environment variables are set when a backup hook is executed:
.TP
.B RSBACKUP_ACT
Set to \fBfalse\fR in \fB\-\-dry\-run\fR mode and \fBtrue\fR
otherwise.
.TP
.B RSBACKUP_DEVICE
The target device name for the backup.
.IP
Note that this may be removed in a future version.
.TP
.B RSBACKUP_HOOK
The name of the hook (i.e. \fBpre\-backup\-hook\fR, etc).
This allows a single hook script to serve as the implementation for
multiple hooks.
.TP
.B RSBACKUP_HOST
The name of the host.
.TP
.B RSBACKUP_SSH_HOSTNAME
The SSH hostname of the host.
.IP
Recall that \fBrsbackup\fR treats the hostname \fBlocalhost\fR specially.
If the hook also needs to do so then it must duplicate this logic.
.TP
.B RSBACKUP_SSH_TARGET
The SSH hostname and username combined for passing to \fBssh\fR(1).
.IP
This will be \fIusername\fB@\fIhostname\fR or just \fIhostname\fR
depending on whether a SSH username was set.
.TP
.B RSBACKUP_SSH_USERNAME
The SSH username of the host.
If no SSH username was set, this variable will not be set.
.TP
.B RSBACKUP_STATUS
(Only for \fBpost\-backup\-hook\fR).
Either \fBok\fR or \fBfailed\fR.
.TP
.B RSBACKUP_STORE
The path to the store directory where the device is mounted.
.TP
.B RSBACKUP_VOLUME
The name of the volume.
.TP
.B RSBACKUP_VOLUME_PATH
The path to the volume.
.PP
The error output from backup hooks is stored in the same backup record
as the output
from \fBrsync\fR.
.PP
The exit status of the \fBpre\-backup\-hook\fR is interpreted as follows:
.TP
.B 0
The hook succeeded.
The backup will be attempted.
.TP
.B 75
The volume is temporarily unavailable.
The backup will not be attempted, as if \fBcheck\-file\fR or \fBcheck-mounted\fR had failed.
.TP
.I anything else
Something went wrong.
The backup will be treated as failed, as if it had been attempted and \fBrsync\fR had failed.
.PP
.BR NOTE :
The current behavior is that the pre/post backup hooks are run
separately for each backup.
In a future version, they may be run only once for all backups of a
given volume, in which case \fBRSBACKUP_DEVICE\fR will no longer be
set.
.PP
See \fBrsbackup\-snapshot\-hook\fR(1) for a hook program that can be
used to back up from Linux LVM snapshots.
.SH PLATFORMS
.SS macOS
Apple's \fBrsync\fR has a nonstandard option to enable backup of
extended attributes.
For local backups you can configure \fBrsbackup\fR to use it with a host-level directive:
.PP
.nf
rsync-extra-options --extended-attributes
.fi
.PP
If backing up a macOS host from a host with a modern \fBrsync\fR, or
vice versa, however, extended attributes and ACLs cannot be backed up
at all.
In that case the affected hosts must disable backup attribute and ACL
backup as follows:
.PP
.nf
rsync-extra-options
.fi
.PP
If an up-to-date \fBrsync\fR is used on macOS hosts, it can be left at
the default.
.SS Windows
\fBrsbackup\fR does not run on Windows.
However, it may be used to back up Windows filesystems.
In this case it can happen that the attributes in the Windows
filesystem do not fit in the backup filesystem; if this happens you
may see errors like this:
.PP
.nf
rsync: rsync_xal_set: lsetxattr(""/backup7/host/volume/2018-02-04/path/to/file"","attrname") failed: No space left on device (28)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
.fi
.PP
In that case the affected volumes must disable attribute backup and ACL
backup as follows:
.PP
.nf
rsync-extra-options
.fi
.SH "SEE ALSO"
\fBrsbackup\fR(1),
\fBrsbackup\-graph\fR(1),
\fBrsbackup.cron\fR(1),
\fBrsbackup\-mount\fR(1),
\fBrsbackup\-snapshot\-hook\fR(1),
\fBrsync\fR(1),
\fBrsbackup\fR(5)
.SH AUTHOR
Richard Kettlewell <rjk@greenend.org.uk>