diff options
author | Richard Kettlewell <rjk@greenend.org.uk> | 2019-09-30 14:24:12 +0100 |
---|---|---|
committer | Richard Kettlewell <rjk@greenend.org.uk> | 2019-09-30 14:24:12 +0100 |
commit | f9fdb23fcaa07fa384a0b5dcf9e1677eb5bde4fc (patch) | |
tree | 792492e4939d9382d05064c2dcdfbee996bddbaa | |
parent | b7b45520ef71ca9608586a0a7382dd85d71470e5 (diff) | |
parent | 63e55bab0141bf2cdaeb2f1d90d2915b03b48332 (diff) |
Merge branch 'issue59'
-rw-r--r-- | doc/CHANGES.html | 7 | ||||
-rw-r--r-- | doc/rsbackup-debian.html | 30 | ||||
-rw-r--r-- | doc/rsbackup.cron.1 | 15 | ||||
-rwxr-xr-x | tools/rsbackup.cron.in | 40 | ||||
-rw-r--r-- | 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 @@ <li>The <code>--force</code> option is extended to override backup policies.</li> + <li>In <code>/etc/rsbackup/defaults</code>, the + <code>hourly</code>, <code>daily</code>, <code>weekly</code> and + <code>monthly</code> settings are gone. Instead, use backup + policies. Fixes <a + href="https://github.com/ewxrjk/rsbackup/issues/59">issue + #59</a>.</li> + </ul> <h2>Changes In rsbackup 6.0</h2> 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</pre> follows:</p> <pre class=example># -# 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=</pre> <ul> <li> - <p><code>hourly</code>, <code>daily</code>, - <code>weekly</code> and <code>monthly</code> define the - hosts to back up at the given frequencies. You can set any - (or all) of them to <code>_all</code> to back up all known - hosts.</p> - - <p>Set them all to <code>""</code>if you have some other - arrangement for initiating backups.</p> - - <p><code>hourly</code> is intended to be used to - opportunistically back up hosts that are often down, for - instance laptops and personal desktops. <code>weekly</code> - and <code>monthly</code> are appropriate for hosts that - almost never change.</p> + + <p>Set <code>backup</code> to control the frequency of backup + attempts. Normally this can be left at <code>hourly</code> and + the frequency of each host and volume’s backups controlled via + backup policies.</p> </li> 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 |