[1mNAME[0m
/etc/rsbackup/config - configuration for rsync-based backup utility
[1mDESCRIPTION[0m
This describes the configuration file syntax for for [1mrsbackup[22m(1).
[1mSYNTAX[0m
[1mLine Splitting[0m
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).
[1mComments and Blank Lines[0m
Anything after the first (unquoted) "#" to appear on a line is ignored.
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).
[1mDirectives and Stanzas[0m
The first word of a line is called a directive. The remaining words,
if any, form its arguments.
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.
A configuration file contains global directives (which must not be in-
dented) and one or more host stanzas. Each host stanza contains one or
more volume stanzas.
Global directives may appear after host stanzas (and host directives
after volume stanzas) provided they are indented correctly.
[1mTime Intervals[0m
A time interval, denoted [4mINTERVAL[24m below, can be either a raw integer,
or an integer with the suffix "s", "m", "h" or "d" for seconds, min-
utes, hours or days respectively.
If there is no suffix then the interpretation is contextual. This be-
havior is deprecated; suffixes will become mandatory in future.
[1mGLOBAL DIRECTIVES[0m
Global directives control some general aspect of the program.
[1mdatabase [4m[22mPATH[0m
The path to the backup database. By default this is [4mLOGS[24m[1m/back-[0m
[1mups.db [22mwhere [4mLOGS[24m is controlled by the [1mlogs [22mdirective below.
[1mdevice [4m[22mDEVICE[0m
Names a device. This can be used multiple times. The store
must have a file called [4mSTORE[24m[1m/device-id [22mwhich contains a known
device name. Backups will only be made to known devices.
When a device is lost or destroyed, remove its device entry and
use the --prune-unknown option to delete records of backups on
it.
Device names may contain letters, digits, dots and underscores.
[1minclude [4m[22mPATH[0m
Include another file as part of the configuration. If [4mPATH[24m is a
directory then the files within it are included (excluding dot-
files, backup and recovery files).
[1mkeep-prune-logs [4m[22mINTERVAL[0m
The time period to keep records of pruned backups for. The de-
fault is 31 days.
[1mlock [4m[22mPATH[0m
Enable locking. If this directive is present then [4mPATH[24m will be
used as a lockfile for operations that change anything
(--backup, --prune, etc).
The lock is made by opening [4mPATH[24m and calling [1mflock[22m(2) on it with
[1mLOCK_EX[22m.
[1mlogs [4m[22mPATH[0m
The directory to store logfiles and backup records. The default
is [4m/var/log/backup[24m.
[1mpost-device-hook [4m[22mCOMMAND[24m...
A command to execute after all backup and prune operations.
This is executed only once per invocation of [1mrsbackup[22m. A backup
is still considered to have succeeded even if the post-access
hook fails (i.e. exits nonzero). See [1mHOOKS [22mbelow.
[1mpre-device-hook [4m[22mCOMMAND[24m...
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 [1mrsbackup [22mand if it fails (i.e. exits
nonzero) then [1mrsbackup [22mterminates immediately. See [1mHOOKS [22mbelow.
[1mprune-timeout [4m[22mINTERVAL[0m
The maximum amount of time to spend pruning, in a single invoca-
tion. 0 means that there is no limit (which is the default).
Note that, if this is directive is used, prune operations timing
out are considered to be normal behavior, and the exit status
will be 0. Most of the diagnostics relating to timeouts are
suppressed unless the [1m-v [22moption is used.
[1mpublic true[22m|[1mfalse[0m
If true, backups are public. Normally backups must only be ac-
cessible by the calling user. This directive suppresses the
check.
[1mstore [22m[[1m--mounted|--no-mounted[22m] [4mPATH[0m
A path at which a backup device may be mounted. This can be
used multiple times.
With the [1m--mounted [22moption (which is the default), [4mPATH[24m must be a
mount point. With [1m--no-mounted [22mit need not be a mount point.
[1mstore-pattern [22m[[1m-mounted|-nomounted[22m] [4mPATTERN[0m
A [1mglob[22m(7) pattern matching paths at which a backup device may be
mounted. This can be used multiple times.
See the description of [1mstore [22mabove for the meanings of the op-
tions.
[1mReport Directives[0m
These are global directives that affect only the HTML report.
[1mcolor-bad [4m[22mCOLOR[0m
The color used to represent bad states (no sufficiently recent
backup) in the report. See below for the interpretation of
[4mCOLOR[24m.
[1mcolor-good [4m[22mCOLOR[0m
The color used to represent good states (a recent backup) in the
report.
[1mreport [22m[[1m+[22m] [[4mKEY[24m][[1m:[4m[22mVALUE[24m][[1m?[4m[22mCONDITION[24m] ...
Defines the report contents. The arguments to this directive
are a sequence of keys, optionally parameterized by a value
and/or a condition.
If the first argument is a [1m+ [22mthen the arguments are added to the
current configuration; otherwise they replace it.
The possible keys, with values where appropriate, are:
[1mgenerated[0m
A timestamp stating when the report was generated.
[1mhistory-graph[0m
A graphic showing the backups available for each volume.
This only works if [1mrsbackup-graph[22m(1) is installed.
[1mh1:[4m[22mHEADING[0m
[1mh2:[4m[22mHEADING[0m
[1mh3:[4m[22mHEADING[0m
Headings at levels 1, 2 and 3.
[1mlogs [22mA list of logs of failed backups.
[1mp:[4m[22mPARAGRAPH[0m
A paragraph of text.
[1mprune-logs[22m[[1m:[4m[22mDAYS[24m]
A list of logs of pruned backups.
[4mDAYS[24m is the number of days of pruning logs to put in the
report. The default is 3.
[1msummary[0m
A table summarizing the backups available for each vol-
ume.
[1mtitle:[4m[22mTITLE[0m
The document title.
[1mwarnings[0m
A list of warning messages.
If a condition is specified then the key is only used if the
condition is true. The possible conditions are:
[1mwarnings[0m
True if there are any warnings to display (i.e. if the
[1mwarnings [22mkey is nonempty).
Within a [4mVALUE[24m the following sequences undergo substitution:
[1m\[4m[22mCHAR[24m Replaced with the single character [4mCHAR[24m.
[1m${[4m[22mVARIABLE[24m[1m}[0m
Replaced with the value of the environment variable [4mVARI-[0m
[4mABLE[24m, if it is set.
The following environment variables are set:
[1mRSBACKUP_CTIME[0m
The local date and time in [1mctime[22m(3) format.
[1mRSBACKUP_DATE[0m
The local date in YYYY-MM-DD format.
The default is equivalent to:
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}"
[1msendmail [4m[22mPATH[0m
The path to the executable to use for sending email. The de-
fault is platform-dependent but typically [4m/usr/sbin/sendmail[24m.
The executable should support the [1m-t[22m, [1m-oee[22m, [1m-oi [22mand [1m-odb [22mop-
tions.
[1mstylesheet [4m[22mPATH[0m
The path to the stylesheet to use in the HTML report. If this
is absent then a built-in default stylesheet is used.
[1mGraph Directives[0m
These are global directives that affect the output of [1mrs-[0m
[1mbackup-graph[22m(1).
[1mcolor-graph-background [4m[22mCOLOR[0m
The background color. See below for the interpretation of
[4mCOLOR[24m.
[1mcolor-graph-foreground [4m[22mCOLOR[0m
The foreground color, i.e. for text.
[1mcolor-month-guide [4m[22mCOLOR[0m
The color for the vertical month guides.
[1mcolor-host-guide [4m[22mCOLOR[0m
The color for the horizontal guides between hosts.
[1mcolor-volume-guide [4m[22mCOLOR[0m
The color for the horizontal guides between volumes.
[1mdevice-color-strategy [4m[22mSTRATEGY[0m
The strategy to use for picking device colors.
A strategy is a name and a sequence of parameters, all of which
are optional.
The possible strategies are:
[1mequidistant-value [4m[22mHUE[24m [4mSATURATION[24m [4mMINVALUE[24m [4mMAXVALUE[0m
Colors are picked with chosen hue and saturation, with
values equally spaced within a range.
The default hue is 0 and the default saturation is 1.
The default value range is from 0 to 1.
[1mequidistant-hue [4m[22mHUE[24m [4mSATURATION[24m [4mVALUE[0m
Colors are picked with chosen saturation and value and
equally spaced hues, starting from [4mHUE[24m.
The default starting hue is 0 and the default saturation
and value are 1.
The default strategy is equivalent to:
device-color-strategy equidistant-value 120 0.75
[1mhorizontal-padding [4m[22mPIXELS[0m
The number pixels to place between horizontally adjacent ele-
ments. The default is 8.
[1mvertical-padding [4m[22mPIXELS[0m
The number pixels to place between vertically adjacent elements.
The default is 2.
[1mhost-name-font [4m[22mFONT[0m
The font description used for host names. See below for the in-
terpretation of [4mFONT[24m.
[1mvolume-name-font [4m[22mFONT[0m
The font description used for volume names.
[1mdevice-name-font [4m[22mFONT[0m
The font description used for device names.
[1mtime-label-font [4m[22mFONT[0m
The font description used for time labels.
[1mgraph-layout [22m[[1m+[22m] [4mPART[24m[1m:[4m[22mCOLUMN[24m[1m,[4m[22mROW[24m[[1m:[4m[22mHV[24m] ...
Defines the graph layout.
The arguments to this directive are a sequence of graph compo-
nent specifications of the form [4mPART[24m[1m:[4m[22mCOLUMN[24m[1m,[4m[22mROW[24m[[1m:[4m[22mHV[24m], where:
[4mPART[24m The name of this component. The following parts are rec-
ognized:
[1mhost-labels[0m
The host name labels for the graph. This is ex-
pected to be in the same row as [1mcontent[22m.
[1mvolume-labels[0m
The volume name labels for the graph. This is ex-
pected to be in the same row as [1mcontent[22m.
[1mcontent[0m
The graph content.
[1mtime-labels[0m
The time labels for the graph. This is expected
to be in the same column as [1mcontent[22m.
[1mdevice-key[0m
The key mapping device names to colors.
[4mCOLUMN[24m The column number for this component. 0 is the leftmost
column.
[4mROW[24m The row number for this component. 0 is the top row.
[4mHV[24m The (optional) justification specification for this com-
ponent. [4mH[24m may be one of the following:
[1mL [22mLeft justification.
[1mC [22mCentre justification.
[1mR [22mRight justification.
[4mV[24m may be one of the following:
[1mT [22mTop justification.
[1mC [22mCentre justification.
[1mB [22mBottom justification.
Parts may be repeated or omitted.
The default layout is equivalent to:
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
[1mColors[0m
[4mCOLOR[24m may be one of the following:
[4mDECIMAL[24m or [1m0x[4m[22mRRGGBB[0m
An integer value representing an RGB triple. It is most conve-
nient to use hexadecimal. For example, black is [1m0x000000[22m, red
is [1m0xFF0000[22m, and so on.
[1mrgb [4m[22mRED[24m [4mGREEN[24m [4mBLUE[0m
Three numbers in the range 0 to 1 representing red, green and
blue components.
[1mhsv [4m[22mHUE[24m [4mSATURATION[24m [4mVALUE[0m
[4mHUE[24m chooses between different primary colors and mixtures of
them. 0 represents red, 120 represents green and 240 represents
blue; intermediate values represent mixed hues.
Normally it would be in the range 0 <= [4mHUE[24m < 360, but values
outside this range are mapped into it.
[4mSATURATION[24m is a number in the range 0 to 1 and (roughly) repre-
sents how colorful the color is. 0 is a shade of grey and 1 is
maximally colorful.
[4mVALUE[24m is a number in the range 0 to 1 and represents the bright-
ness of the color.
See https://en.wikipedia.org/wiki/HSL_and_HSV for a fuller dis-
cussion of these terms.
[1mFonts[0m
[4mFONT[24m is a Pango font description. The syntax is "[[4mFAMILY-LIST[24m] [[4mSTYLE-[0m
[4mOPTIONS[24m] [[4mSIZE[24m]" where:
[4mFAMILY-LIST[0m
A comma-separate list of font families. These necessarily de-
pend on the fonts installed locally but Pango recognizes [1mmono-[0m
[1mspace[22m, [1msans [22mand and [1mserif [22mas generic family names.
To get a list of Pango fonts:
rsbackup-graph --fonts
[4mSTYLE-OPTIONS[0m
A whitespace-separated list of style, variant, weight, stretch
and gravity options.
The possible style options are [1mroman [22m(the default), [1moblique [22mand
[1mitalic.[0m
The possible variant options are [1msmall-caps[22m.
The possible weight options are [1mthin, ultra-light[22m, [1mlight[22m,
[1msemi-light, book[22m, [1mregular [22m(the default), [1mmedium[22m, [1msemi-bold[22m,
[1mbold[22m, [1multra-bold[22m, [1mheavy [22mand [1multra-heavy[22m.
The possible stretch options are [1multra-condensed[22m, [1mcondensed[22m,
[1msemi-condensed[22m, [1msemi-expanded[22m, [1mexpanded [22mand [1multra-expanded[22m.
The possible gravity options are [1msouth [22m(the default), [1mnorth[22m,
[1meast [22mand [1mwest[22m.
[4mSIZE[24m The font size in points, or [4mPIXELS[24m[1mpx [22mfor a font size in pixels.
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.
[1mINHERITABLE DIRECTIVES[0m
Inheritable directives control an aspect of one or more backups. They
can be specified at the global level or in a [1mhost [22mor [1mvolume [22mstanza (see
below). If one appears in multiple places then volume settings over-
ride host settings and host settings override global settings.
[1mbackup-parameter [4m[22mNAME[24m [4mVALUE[0m
Set a parameter for the backup policy. See [1mBACKUP POLICIES [22mbe-
low.
[1mbackup-parameter --remove [4m[22mNAME[0m
Remove a parameter for the backup policy. See [1mBACKUP POLICIES[0m
below.
[1mbackup-policy [4m[22mNAME[0m
The backup policy to use. See [1mBACKUP POLICIES [22mbelow.
[1mbackup-time [4m[22mEARLIEST[24m-[4mLATEST[0m
Set the time window within a day during which backups may be
initiated. [4mEARLIEST[24m and [4mLATEST[24m take the form [4mHOUR[24m:[4mMINUTE[24m or
[4mHOUR[24m:[4mMINUTE[24m:[4mSECOND[24m.
This directive only affects backup creation, and only applies if
no host/volume selectors appear on the command line.
[1mgroup [4m[22mGROUP[0m
The concurrency group for this host or group. The default for a
host is the name from the host stanza. See [1mCONCURRENCY [22mbelow.
[1mhook-timeout [4m[22mINTERVAL[0m
How long to wait before concluding a hook has hung. The default
is 0, which means to wait indefinitely.
[1mhost-check always-up[0m
Assume that the host is always up.
[1mhost-check ssh[0m
Check whether the host is up using SSH. This is the default
host check behavior.
[1mhost-check command [4m[22mCOMMAND[24m...
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.
[1mmax-age [4m[22mINTERVAL[0m
The maximum age of the most recent backup before you feel uncom-
fortable. The default is 3 days, meaning that if a volume
hasn't been backed up in the last 3 days it will have red ink in
the HTML report.
[1mpost-volume-hook [4m[22mCOMMAND[24m...
A command to execute after finishing backups of a volume, or af-
ter they failed. A backup is still considered to have succeeded
even if the post-backup hook fails (exits nonzero). See [1mHOOKS[0m
below.
The hook can be suppressed with an empty [4mCOMMAND[24m (e.g. if you
have a global hook and wish to suppress it for a single volume).
[1mpre-volume-hook [4m[22mCOMMAND[24m...
A command to execute before starting a backups of a volume. If
this hook fails (i.e. exits nonzero) then the backups are not
made and the post-volume-hook will not be run. See [1mHOOKS [22mbelow.
The hook can be suppressed with an empty [4mCOMMAND[24m (e.g. if you
have a global hook and wish to suppress it for a single volume).
This hook can override the source path for the volume by writing
a new source path to standard output.
[1mprune-parameter [4m[22mNAME[24m [4mVALUE[0m
Set a parameter for the pruning policy. See [1mPRUNING [22mbelow.
[1mprune-parameter --remove [4m[22mNAME[0m
Remove a parameter for pruning policy.
[1mprune-policy [4m[22mNAME[0m
The pruning policy to use. See [1mPRUNING [22mbelow.
[1mbackup-job-timeout [4m[22mINTERVAL[0m
How long to wait before concluding rsync has hung. The default
is 0, which means to wait indefinitely.
[1mrsync-command [4m[22mCOMMAND[0m
The command to execute to make a backup. The default is [1mrsync[22m.
[1mrsync-base-options [4m[22mOPTIONS[24m ...
The options to supply to the rsync command. The default is
[1m--archive --sparse --numeric-ids --compress --fuzzy --hard-links[0m
[1m--delete --stats --no-human-readable[22m.
[1mrsync-extra-options [4m[22mOPTIONS[24m ...
Additional options to supply to the rsync command. The default
is [1m--xattrs --acls --open-noatime[22m.
See [1mPLATFORMS [22mfor how to use this directive when backing up ma-
cOS or Windows platforms.
[1mrsync-io-timeout [4m[22mINTERVAL[0m
The I/O timeout (passed as [1m--timeout[22m) to [1mrsync[22m. The default is
0, meaning no timeout.
[1mrsync-link-dest true[22m|[1mfalse[0m
If true, use rsync's [1m--link-dest [22moption to save space in back-
ups. The default is [1mtrue[22m.
[1mrsync-remote COMMAND[0m
If nonempty, passed to [1mrsync [22mas the [1m--rsync-path [22moption.
[1mssh-timeout [4m[22mINTERVAL[0m
How long to wait before concluding a host is down. The default
is 60 seconds.
[1mHOST DIRECTIVES[0m
A host stanza is started by a [1mhost [22mdirective.
[1mhost [4m[22mHOST[0m
Introduce a host stanza. The name is used for the backup direc-
tory for this host.
The following directives, and [1mvolume [22mstanzas (see below), can appear in
a host stanza:
[1mdevices [4m[22mPATTERN[0m
A [1mglob[22m(3) pattern restricting the devices that this host will be
backed up to.
Note that only backup creation honors this restriction. Pruning
and retiring do not.
[1mhostname [4m[22mHOSTNAME[0m
The SSH hostname for this host. The default is the name from
the host stanza.
The hostname [1mlocalhost [22mis treated specially: it is assumed to
always be identical to the local system, so files will be read
from the local filesystem.
[1mpriority [4m[22mINTEGER[0m
The priority of this host. Hosts are backed up in descending
priority order. The default priority is 0.
[1muser [4m[22mUSERNAME[0m
The SSH username for this host. The default is not to supply a
username.
In addition, inheritable directives can appear in a host stanza, and
override any appearance of them at the global level.
The contents of a host stanza must be indented consistently relative to
the [1mhost [22mdirective that introduces it.
Remote hosts are accessed by SSH. The user [1mrsbackup [22mruns as must be
able to connect to the remote host (and without a password being en-
tered if it is to be run from a cron job or similar).
[1mVOLUME DIRECTIVES[0m
A volume stanza is started by a [1mvolume [22mdirective. It can only appear
within a host stanza.
[1mvolume [4m[22mVOLUME[24m [4mPATH[0m
Introduce a volume stanza. The name is used for the backup di-
rectory for this volume. The path is the absolute path on the
host.
The following directives can appear in a volume stanza:
[1mcheck-file [4m[22mPATH[0m
Checks that [4mPATH[24m exists before backing up the volume. [4mPATH[24m 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.
This check is done before executing the [1mpre-volume-hook[22m, so it
applies to the real path to the volume, not the rewritten path.
[1mcheck-mounted true[22m|[1mfalse[0m
If true, checks that the volume's path is a mount point before
backing up the volume.
This check is done before executing the [1mpre-volume-hook[22m, so it
applies to the real path to the volume, not the rewritten path.
Note that if multiple [1mcheck- [22moptions are used, all checks must
pass for the volume to be backed up.
[1mexclude [4m[22mPATTERN[0m
An exclusion for this volume. The pattern is passed to the
rsync [1m--exclude [22moption. This directive may appear multiple
times per volume.
See the rsync man page for full details.
[1mtraverse true[22m|[1mfalse[0m
If true, traverse mount points. This suppresses the rsync
[1m--one-file-system [22moption.
In addition, inheritable directives can appear in a volume stanza, and
override any appearance of them at the host or global level.
The contents of a volume stanza must be indented consistently relative
to the [1mvolume [22mdirective that introduces it.
[1mBACKUP POLICIES[0m
Backup policies determine when a backup is made. The available poli-
cies are listed below. The default policy is [1mdaily[22m.
[1malways[0m
This policy creates a backup at every opportunity.
[1mdaily[0m
This policy creates at most one backup per calendar day, as understood
in local time.
[1minterval[0m
This policy enforces a minimum interval between backups. The following
backup parameters are supported:
[1mmin-interval [4m[22mINTERVAL[0m
The minimum interval between backups.
The [1m--force [22moption can be used to override backup policies, forcing all
selected volumes to be backed up unconditionally.
[1mPRUNING[0m
This is process of removing old backups (using the [1m--prune [22moption).
The pruning policy used to determine which backups to remove is set
with the inheritable [1mprune-policy [22mdirective, and parameters to the pol-
icy set via the [1mprune-parameter [22mdirective.
The available policies are listed below. The default policy is [1mage[22m.
[1mage[0m
This policy deletes backups older than a minimum age, provided a mini-
mum number of backups on a device remain available. The following
pruning parameters are supported:
[1mmin-backups [4m[22mBACKUPS[0m
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.
[1mprune-age [4m[22mINTERVAL[0m
The age after backups become eligible for pruning. Only backups
more than this many days old will be pruned. The default is 366
days and the minimum is 1 day.
For backwards compatibility, these values can also be set using the di-
rectives of the same name. This will be disabled in a future version.
[1mdecay[0m
This policy thins out backups older than a minimum age, using a config-
urable decay pattern that arranges to keep a declining number of back-
ups with age.
The idea is that backup history is partitioned into a series of win-
dows. Each window is a fixed multiple of the size of the previous one.
The pruning policy arranges that only one backup (per device) is pre-
served within each window.
For example, with the default configuration, the first window is 1 day
long and will contain one backup. The second window is two days long
and again, only contains one backup. The third window is four days
long, and so on.
The effect is that the density of backups over time decays exponen-
tially.
See ]8;;https://www.greenend.org.uk/rjk/rsbackup/decay.pdf\decay.pdf]8;;\ for more information.
The following pruning parameters are supported:
[1mdecay-start [4m[22mINTERVAL[0m
The age after backups become eligible for pruning. Only backups
more than this many days old will be pruned. The default is 1
day and the minimum is 1 day.
[1mdecay-limit [4m[22mINTERVAL[0m
The age after which backups are always pruned. Backups older
than this will always be pruned unless this would leave no back-
ups at all. The default is 366 days and the minimum is 1 day.
[1mdecay-scale [4m[22mSCALE[0m
The scale at which the decay window is expanded. The default is
2 and the (exclusive) minimum is 1.
[1mdecay-window [4m[22mINTERVAL[0m
The size of the decay window. The default is 1 day and the min-
imum is 1 day.
[1mexec[0m
This policy executes a subprogram with parameters and additional infor-
mation supplied in the environment.
The following parameters are supported:
[1mpath [22mThe path to the subprogram to execute.
Any additional parameters are supplied to the subprogram via environ-
ment variables, prefixed with [1mPRUNE_[22m. Additionally the following envi-
ronment variables are set:
[1mPRUNE_DEVICE[0m
The name of the device containing the backup.
[1mPRUNE_HOST[0m
The name of the host.
[1mPRUNE_ONDEVICE[0m
The list of backups on the device, by timestamp. This list ex-
cludes any that have already been scheduled for pruning.
[1mPRUNE_TOTAL[0m
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.
[1mPRUNE_VOLUME[0m
The name of the volume.
These environment variables all override any parameters with clashing
names.
The output should be a list of backups to prune, one per line (in any
order). Each line should contain the timestamp of the backup to prune
(i.e. the same value as appeared in [1mPRUNE_ONDEVICE[22m), followed by a
colon, followed by the reason that this backup is to be pruned.
As a convenience, if the argument to [1mprune-policy [22mstarts with [1m/ [22mthen
the [1mexec [22mpolicy is chosen with the policy name as the [1mpath [22mparameter.
[1mnever[0m
This policy never deletes any backups.
[1mHOOKS[0m
A hook is a command executed by [1mrsbackup [22mjust before or just after some
action. The command is passed directly to [1mexecvp[22m(3); to use a shell
command, therefore, either wrap it in a script or invoke the shell with
the [1m-c [22moption.
All hooks are run in [1m--dry-run [22mmode. Hook scripts must honor [1mRS-[0m
[1mBACKUP_ACT [22mwhich will be set to [1mfalse [22min this mode and [1mtrue [22motherwise.
[1mDevice Hooks[0m
Device hooks are executed (once) before doing anything that will access
backup devices (even just to read them).
The following environment variables are set when a device hook is exe-
cuted:
[1mRSBACKUP_ACT[0m
Set to [1mfalse [22min [1m--dry-run [22mmode and [1mtrue [22motherwise.
[1mRSBACKUP_DEVICES[0m
A space-separated list of known device names.
[1mRSBACKUP_HOOK[0m
The name of the hook (i.e. [1mpre-device-hook[22m, etc). This allows a
single hook script to serve as the implementation for multiple
hooks.
Device hooks used to be called access hooks.
[1mVolume Hooks[0m
Pre-volume hooks are executed before all the backups of a volume, and
post-volume hooks after all backups of the volume. Possible uses for
volume hooks include snapshotting volumes or mounting volumes.
When a volume hook is executed, the environment variables listed in [1mEN-[0m
[1mVIRONMENT [22mbelow are set, along with the following:
[1mRSBACKUP_HOOK[0m
The name of the hook (i.e. [1mpre-volume-hook[22m, etc). This allows a
single hook script to serve as the implementation for multiple
hooks.
The exit status of the [1mpre-volume-hook [22mis interpreted as follows:
[1m0 [22mThe hook succeeded. The backup will be attempted.
[1m75 [22mThe volume is temporarily unavailable. The backup will not be
attempted, as if [1mcheck-file [22mor [1mcheck-mounted [22mhad failed.
[4manything[24m [4melse[0m
Something went wrong. The backup will be treated as failed, as
if it had been attempted and [1mrsync [22mhad failed.
See [1mrsbackup-snapshot-hook[22m(1) for a hook program that can be used to
back up from Linux LVM snapshots.
Volume hooks used to be called backup hooks.
[1mENVIRONMENT[0m
When a hook or [1mrsync [22mare executed, the following environment variables
are set:
[1mRSBACKUP_ACT[0m
Set to [1mfalse [22min [1m--dry-run [22mmode and [1mtrue [22motherwise.
[1mRSBACKUP_HOST[0m
The name of the host.
[1mRSBACKUP_GROUP[0m
The name of the concurrency group. See the [1mgroup [22mdirective.
[1mRSBACKUP_SSH_HOSTNAME[0m
The SSH hostname of the host.
Recall that [1mrsbackup [22mtreats the hostname [1mlocalhost [22mspecially.
If the hook also needs to do so then it must duplicate this
logic.
[1mRSBACKUP_SSH_TARGET[0m
The SSH hostname and username combined for passing to [1mssh[22m(1).
This will be [4musername[24m[1m@[4m[22mhostname[24m or just [4mhostname[24m depending on
whether a SSH username was set.
[1mRSBACKUP_SSH_USERNAME[0m
The SSH username of the host. If no SSH username was set, this
variable will not be set.
[1mRSBACKUP_VOLUME[0m
The name of the volume.
[1mRSBACKUP_VOLUME_PATH[0m
The path to the volume.
[1mCONCURRENCY[0m
Any given device only gets used for one thing at a time; it will never
happen that two backups, or two prunes, access the same device.
No concurrency group will ever have more than one backup made from it
any a time. By default a concurrency group is just a single host, but
this can be changed in two ways:
+o At the host level the [1mgroup [22mdirective can put the host into a
different concurrency group. For example, this might be used
for a collection of hosts that shared the same physical hard-
ware.
+o At the volume level the [1mgroup [22mdirective can put the volume into
a different concurrency group. For example this might be used
to group volumes in line with their underlying physical storage,
with one concurrency group per physical disk.
No two hooks will be executed concurrently, even if they apply to dif-
ferent concurrency groups and different devices. However, a hook may
execute while a backup (for a different concurrency group and a differ-
ent device) is executing.
[1mNOTES[0m
[1mResource Control[0m
Large backup jobs can have unreasonable impacts on kernel memory,
evicting applications and cache data by the gigabyte just for single-
use copies of backup data.
On Linux this problem can be addressed with with the memory cgroup con-
troller.
First, a slice is created on each host (both the back server and client
machines):
[Unit]
Description=Memory-bound slice for rsbackup
Before=slices.target
[Slice]
MemoryAccounting=true
MemoryHigh=128M
MemoryMax=256M
Second, [1mrsbackup [22mis run with a memory use limit:
systemd-run --quiet --pipe --slice membound rsbackup --backup
If you are using the Debian cron job then this can be configured in
[4m/etc/rsbackup/defaults[24m:
nicely="systemd-run --quiet --pipe --slice membound"
Finally, to control resource use on client machines, add the following
to their [1mhost [22msections:
rsync-remote "systemd-run --quiet --pipe --slice membound rsync"
See also: [1msystemd-run[22m(1), [1msystemctl[22m(1), [1msystemd.slice[22m(5), [1msystemd.re-[0m
[1msource-control[22m(5), [1mrsbackup.cron[22m(1).
[1mmacOS[0m
Apple's [1mrsync [22mdoes not have the --open-noatime option, and has a non-
standard option to enable backup of extended attributes.
For local backups you can configure [1mrsbackup [22mto backup extended attrib-
utes with a host-level directive:
rsync-extra-options --extended-attributes
If backing up a macOS host from a host with a modern [1mrsync[22m, 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:
rsync-extra-options
If an up-to-date [1mrsync [22mis used on macOS hosts, it can be left at the
default.
[1mWindows[0m
[1mrsbackup [22mdoes 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:
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]
In that case the affected volumes must disable attribute backup and ACL
backup as follows:
rsync-extra-options --open-noatime
[1mSEE ALSO[0m
[1mrsbackup[22m(1), [1mrsbackup-graph[22m(1), [1mrsbackup.cron[22m(1), [1mrsbackup-mount[22m(1),
[1mrsbackup-snapshot-hook[22m(1), [1mrsync[22m(1), [1mrsbackup[22m(5)
[1mAUTHOR[0m
Richard Kettlewell <rjk@greenend.org.uk>