Now stuff like the media library doesn't keep old mistakes and changed
files forever, but we can still keep lots of history for most of the
filesystems.
in this case.
This command clears the
.B like
in this case.
This command clears the
.B like
+list, and resets the retention policy to its default (i.e., the to
+policy defined prior to the first
+.B host
+command).
.TP
.BI "like " "host\fR ..."
Declare that subsequent filesystems are `similar' to like-named
.TP
.BI "like " "host\fR ..."
Declare that subsequent filesystems are `similar' to like-named
Expiry considers each existing dump against the policy lines in order:
the last applicable line determines the dump's fate \(en so you should
probably write the lines in decreasing order of duration.
Expiry considers each existing dump against the policy lines in order:
the last applicable line determines the dump's fate \(en so you should
probably write the lines in decreasing order of duration.
+.PP
+Groups of
+.B retain
+commands between
+.B host
+and/or
+.B backup
+commands collectively define a retention policy. Once a policy is
+defined, subsequent
+.B backup
+operations use the policy. The first
+.B retain
+command after a
+.B host
+or
+.B backup
+command clears the policy and starts defining a new one. The policy
+defined before the first
+.B host
+is the
+.I default
+policy: at the start of each
+.B host
+stanza, the policy is reset to the default.
.TP
.BI "retry " count
The
.TP
.BI "retry " count
The
_hostrun () {
h=$1 cmd=$2
_hostrun () {
h=$1 cmd=$2
- ## Like hostrun, but without the complicated logging, but targetted at a
+ ## Like hostrun, but without the complicated logging, and targetted at a
## specific host.
if localp $h; then sh -c "$cmd"
## specific host.
if localp $h; then sh -c "$cmd"
$verbose " commit"
## Expire old backups.
$verbose " commit"
## Expire old backups.
+ case "${expire_policy+t},${default_policy+t}" in
+ ,t) expire_policy=$default_policy ;;
+ esac
case "${expire_policy+t},$dryrun" in
t,nil) run "expiry for $host:$fs" expire_backups ;;
t,t) expire_backups ;;
esac
case "${expire_policy+t},$dryrun" in
t,nil) run "expiry for $host:$fs" expire_backups ;;
t,t) expire_backups ;;
esac
## Report success.
case $dryrun in
## Report success.
case $dryrun in
###--------------------------------------------------------------------------
### Configuration functions.
###--------------------------------------------------------------------------
### Configuration functions.
-host () { host=$1; like=; $verbose "host $host"; }
+host () {
+ host=$1
+ like=
+ case "${expire_policy+t},${default_policy+t}" in
+ t,) default_policy=$expire_policy ;;
+ esac
+ unset expire_policy
+ $verbose "host $host"
+}
+
snaptype () { snap=$1; shift; snapargs="$*"; retry=0; }
rsyncargs () { rsyncargs="$*"; }
like () { like="$*"; }
retry () { retry="$*"; }
retain () {
snaptype () { snap=$1; shift; snapargs="$*"; retry=0; }
rsyncargs () { rsyncargs="$*"; }
like () { like="$*"; }
retry () { retry="$*"; }
retain () {
+ case $clear_policy in t) unset expire_policy; clear_policy=nil ;; esac
expire_policy="${expire_policy+$expire_policy
}$*"
}
expire_policy="${expire_policy+$expire_policy
}$*"
}