From 63e55bab0141bf2cdaeb2f1d90d2915b03b48332 Mon Sep 17 00:00:00 2001
From: Richard Kettlewell
Date: Sat, 7 Sep 2019 13:53:07 +0100
Subject: Remove backup frequency from cron configuration
It is supplanted by backup policies.
re #59
UNTESTED
---
doc/CHANGES.html | 7 +++++++
doc/rsbackup-debian.html | 30 +++++++++---------------------
doc/rsbackup.cron.1 | 15 ++++++++-------
tools/rsbackup.cron.in | 40 ++++++++++++++++++----------------------
tools/rsbackup.defaults | 13 +++++--------
5 files changed, 47 insertions(+), 58 deletions(-)
diff --git a/doc/CHANGES.html b/doc/CHANGES.html
index da04d10..587b13f 100644
--- a/doc/CHANGES.html
+++ b/doc/CHANGES.html
@@ -22,6 +22,13 @@
The --force
option is extended to override
backup policies.
+ In /etc/rsbackup/defaults
, the
+ hourly
, daily
, weekly
and
+ monthly
settings are gone. Instead, use backup
+ policies. Fixes issue
+ #59.
+
Changes In rsbackup 6.0
diff --git a/doc/rsbackup-debian.html b/doc/rsbackup-debian.html
index 47e96b8..419119b 100644
--- a/doc/rsbackup-debian.html
+++ b/doc/rsbackup-debian.html
@@ -53,14 +53,11 @@ include /etc/rsbackup/hosts.d
follows:
#
-# List hosts to backup hourly, daily, weekly and monthly
-# - set the empty string to back up no hosts (at that frequency)
-# - use the special string "_all" to back up everything
+# Set backup=hourly|daily|weekly|monthly to control frequency of
+# backup attempts. (Use backup policies for fine-grained control over
+# when backups happen.)
#
-hourly=""
-daily=_all
-weekly=""
-monthly=""
+backup=hourly
#
# Set report=hourly|daily|weekly|monthly to control frequency of
@@ -95,20 +92,11 @@ nicely=
-
-
hourly
, daily
,
- weekly
and monthly
define the
- hosts to back up at the given frequencies. You can set any
- (or all) of them to _all
to back up all known
- hosts.
-
- Set them all to ""
if you have some other
- arrangement for initiating backups.
-
- hourly
is intended to be used to
- opportunistically back up hosts that are often down, for
- instance laptops and personal desktops. weekly
- and monthly
are appropriate for hosts that
- almost never change.
+
+ Set backup
to control the frequency of backup
+ attempts. Normally this can be left at hourly
and
+ the frequency of each host and volume’s backups controlled via
+ backup policies.
diff --git a/doc/rsbackup.cron.1 b/doc/rsbackup.cron.1
index 748cf4c..365a96a 100644
--- a/doc/rsbackup.cron.1
+++ b/doc/rsbackup.cron.1
@@ -51,6 +51,10 @@ variables:
Define the list of hosts to back up at a given frequency.
Use the special string \fB_all\fR to back up all hosts.
.TP
+.B backup
+Defines the frequency to attempt backups.
+(Use backup policies for full control.)
+.TP
.B report
Defines the frequency to send an email report.
.TP
@@ -65,14 +69,11 @@ Defines the frequency of pruning incomplete backups.
.SS Example
.nf
#
-# List hosts to backup hourly, daily, weekly and monthly
-# - set the empty string to back up no hosts (at that frequency)
-# - use the special string "_all" to back up everything
+# Set backup=hourly|daily|weekly|monthly to control frequency of
+# backup attempts. (Use backup policies for fine-grained control over
+# when backups happen.)
#
-hourly=""
-daily=_all
-weekly=""
-monthly=""
+backup=hourly
#
# Set report=hourly|daily|weekly|monthly to control frequency of
diff --git a/tools/rsbackup.cron.in b/tools/rsbackup.cron.in
index 1fbbbbc..1dd7f70 100755
--- a/tools/rsbackup.cron.in
+++ b/tools/rsbackup.cron.in
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# Copyright © 2011, 2014, 2015 Richard Kettlewell.
+# Copyright © 2011, 2014, 2015, 2019 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
@@ -23,6 +23,13 @@ verbosely() {
"$@"
}
+# Defaults --------------------------------------------------------------------
+
+backup=hourly
+prune=daily
+prune_incomplete=weekly
+report=daily
+
# Initial settings ------------------------------------------------------------
backupargs=""
@@ -85,23 +92,19 @@ frequency="$1"
. /etc/rsbackup/defaults
+# Warn about obsolete configuration -------------------------------------------
+
+if [ "$hourly$daily$weekly$monthly" != "" ]; then
+ echo "WARNING: obsolete configuration found in /etc/rsbackup/defaults" >&2
+fi
+
# Validate frequency ----------------------------------------------------------
# For lower frequencies, we always wait until we can take the lock.
case "$frequency" in
hourly )
- hosts="$hourly"
- ;;
-daily )
- hosts="$daily"
- wait="--wait"
;;
-weekly )
- hosts="$weekly"
- wait="--wait"
- ;;
-monthly )
- hosts="$monthly"
+daily | weekly | monthly )
wait="--wait"
;;
* )
@@ -109,18 +112,11 @@ monthly )
exit 1
esac
-# Decide what to back up ------------------------------------------------------
+# Decide whether to backup ----------------------------------------------------
-case "$hosts" in
-"" )
- ;;
-_all )
+if [ "$backup" = "$frequency" ]; then
backupargs="$backupargs --backup"
- ;;
-* )
- backupargs="$backupargs --backup $hosts"
- ;;
-esac
+fi
# Decide whether to prune -----------------------------------------------------
diff --git a/tools/rsbackup.defaults b/tools/rsbackup.defaults
index 53d9389..5bef4da 100644
--- a/tools/rsbackup.defaults
+++ b/tools/rsbackup.defaults
@@ -1,12 +1,9 @@
#
-# List hosts to backup hourly, daily, weekly and monthly
-# - set the empty string to back up no hosts (at that frequency)
-# - use the special string "_all" to back up everything
-#
-hourly=""
-daily=_all
-weekly=""
-monthly=""
+# Set backup=hourly|daily|weekly|monthly to control frequency of
+# backup attempts. (Use backup policies for fine-grained control over
+# when backups happen.)
+#
+backup=hourly
#
# Set report=hourly|daily|weekly|monthly to control frequency of
--
cgit v1.2.3