summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2015-11-13 09:53:17 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2015-11-13 09:53:17 +0000
commit9ccf85b48ac2adb8bdedba672208d8b7e3a91112 (patch)
treeb5ef1e4506b416bac0a7dcd392f8b7437ea08d3e
parent0bd96396842d26af63dd2c0cf64dbde154e2df5d (diff)
Do not prune unless there is at least one backup that is a week old.
-rwxr-xr-xbin/byteback-prune10
1 files changed, 10 insertions, 0 deletions
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