From 9ccf85b48ac2adb8bdedba672208d8b7e3a91112 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 13 Nov 2015 09:53:17 +0000 Subject: Do not prune unless there is at least one backup that is a week old. --- bin/byteback-prune | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bin/byteback-prune') diff --git a/bin/byteback-prune b/bin/byteback-prune index 0cf87a7..5cd9a35 100755 --- a/bin/byteback-prune +++ b/bin/byteback-prune @@ -123,8 +123,18 @@ unless @do_prune_force warn('Not enough disc space history to make a decision') exit 0 end + + # + # Do not prune unless at least one snapshot is a week old + # + last_week = now - 7*86400 + unless snapshots.any?{|snapshot| last_week > snapshot.time} + warn('There are no snapshots older than a week. Not pruning.') + exit 0 + end end + exit 0 unless (@do_prune && File.exist?(PRUNING_FLAG)) || @do_prune_force -- cgit v1.2.3