fix. --keep-within and --keep-<period> are different options.

This commit is contained in:
2022-05-22 20:18:05 -04:00
parent dfe2f4d100
commit 8e7841b4cc
4 changed files with 88 additions and 45 deletions
+33 -20
View File
@@ -12,17 +12,9 @@
"dummy" = a boolean; if you need to create a "dummy" server, set this to "true".
It will *not* be parsed or executed upon.
It won't even be created by an init operation or show up in a repolist operation.
"pruneRetention" = an ISO 8601 duration to be used as the default rentention period during a prune operation.
-->
<!--
The pruneRetention attribute's format (ISO 8601 Duration) can be found here:
https://en.wikipedia.org/wiki/ISO_8601#Durations).
It must be positive. The "alternative"/"extended" variant (the one using colons) should be supported
(but may be unpredictable).
It is optional, but can be used as a fallback during a prune operation if a repo child does not specify one.
The below example would prune anything older than 1 month, 2 minutes, and 30 seconds.
-->
<server target="fq.dn.tld" remote="true" rsh="ssh -p 22" user="root" pruneRetention="P1MT2M30S">
<server target="fq.dn.tld" remote="true" rsh="ssh -p 22" user="root">
<!-- You can (and probably will) have multiple repos for each server. -->
<!--
"name" = the repository name.
@@ -30,20 +22,41 @@
to enter it interactively and securely.
"dummy" = see server[@dummy] explanation.
"compression" = see https://borgbackup.readthedocs.io/en/stable/usage/create.html (-C option)
"pruneRetention" = an ISO 8601 duration to be used as the rentention period during a prune operation.
If not specified, uses ../server/[@pruneRetention].
If ../server/[@pruneRetention] was not specified, this repo will be skipped during a prune.
-->
<repo name="testrepo"
password="SuperSecretPassword"
compression="lzma,9"
pruneRetention="P1Y"><!-- One year. -->
<!-- Each path entry is a path to back up.
See https://borgbackup.readthedocs.io/en/stable/usage/create.html
Note that globbing, etc. is *disabled* for security reasons, so you will need to specify all
directories explicitly. -->
compression="lzma,9">
<!--
keepWithin specifies a flat time period for archive retention during a prune.
The keepWithin attribute's format (ISO 8601 Duration) can be found here:
https://en.wikipedia.org/wiki/ISO_8601#Durations).
It must be positive. The "alternative"/"extended" variant (the one using colons) should be supported
(but may be unpredictable).
It is optional. If no keepWithin or keepLast (below) is specified, this repo will be skipped during
prune operations.
The below example would prune anything older than 1 month, 2 minutes, and 30 seconds.
If both keepWithin and keepLast is provided, keepLast only affects archives *before* the time period
specified by keepWithin.
-->
<keepWithin>P1MT2M30S</keepWithin>
<!--
keepLast specifies a *policy* for retention.
It can be used to specify explicit "N archives per Y". For example, the below retains the first
archive for each month (going back 2 months), and the first archive each year for the last three years.
-->
<keepLast>
<perMonth>2</perMonth>
<perYear>3</perYear>
</keepLast>
<!--
Each path entry is a path to back up.
See https://borgbackup.readthedocs.io/en/stable/usage/create.html
Note that globbing, etc. is *disabled* for security reasons, so you will need to specify all
parent directories explicitly.
Recursing is enabled, though.
-->
<path>/a</path>
<!-- Each exclude entry should be a subdirectory of a <path> (otherwise it wouldn't match, obviously). -->
<!-- Each exclude entry should be a subdirectory of a <path> (otherwise it wouldn't match). -->
<exclude>/a/b</exclude>
<!-- Prep items are executed in non-guaranteed order (but are likely to be performed in order given).
If you require them to be in a specific order, you should use a wrapper script and