summaryrefslogtreecommitdiff
path: root/bin/byteback-prune
diff options
context:
space:
mode:
Diffstat (limited to 'bin/byteback-prune')
-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