summaryrefslogtreecommitdiff
path: root/rsync_tmbackup.sh
diff options
context:
space:
mode:
authorNeddy70 <6915421+neddy70@users.noreply.github.com>2018-03-17 11:41:14 +1100
committerNeddy70 <6915421+neddy70@users.noreply.github.com>2018-03-17 11:41:14 +1100
commitb0654c96e0ebbbbd5780f1f16f5b0ae4816f1717 (patch)
treeed8356879e7c2ee59182cad61ad9713d0369e485 /rsync_tmbackup.sh
parent4af7610dd15a0d8a9e2755f202fd29dc312cf8eb (diff)
Added option to disable automatically purging old backups when out of space.
Diffstat (limited to 'rsync_tmbackup.sh')
-rwxr-xr-xrsync_tmbackup.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/rsync_tmbackup.sh b/rsync_tmbackup.sh
index cdd3fd1..6c6c58c 100755
--- a/rsync_tmbackup.sh
+++ b/rsync_tmbackup.sh
@@ -46,6 +46,8 @@ fn_display_usage() {
echo " --strategy Set the expiration strategy. Default: \"1:1 30:7 365:30\" means after one"
echo " day, keep one backup per day. After 30 days, keep one backup every 7 days."
echo " After 365 days keep one backup every 30 days."
+ echo " --no-auto-expire Disable automatically deleting backups when out of space. Instead an error"
+ echo " is logged, and the backup is aborted."
echo ""
echo "For more detailed help, please see the README file:"
echo ""
@@ -215,6 +217,7 @@ EXCLUSION_FILE=""
LOG_DIR="$HOME/.$APPNAME"
AUTO_DELETE_LOG="1"
EXPIRATION_STRATEGY="1:1 30:7 365:30"
+AUTO_EXPIRE="1"
RSYNC_FLAGS="-D --compress --numeric-ids --links --hard-links --one-file-system --itemize-changes --times --recursive --perms --owner --group --stats --human-readable"
@@ -246,6 +249,9 @@ while :; do
LOG_DIR="$1"
AUTO_DELETE_LOG="0"
;;
+ --no-auto-expire)
+ AUTO_EXPIRE="0"
+ ;;
--)
shift
SRC_FOLDER="$1"
@@ -459,6 +465,12 @@ while : ; do
NO_SPACE_LEFT="$(grep "No space left on device (28)\|Result too large (34)" "$LOG_FILE")"
if [ -n "$NO_SPACE_LEFT" ]; then
+
+ if [[ $AUTO_EXPIRE == "0" ]]; then
+ fn_log_error "No space left on device, and automatic purging of old backups is disabled."
+ exit 1
+ fi
+
fn_log_warn "No space left on device - removing oldest backup and resuming."
if [[ "$(fn_find_backups | wc -l)" -lt "2" ]]; then