summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-22 02:56:25 +0000
committerMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-22 02:56:25 +0000
commitbf5aecde3d5c8094a35e85ee37e933657f314933 (patch)
treea61d9b72864fd14cc3d026a8ae83b73cd4eb8449
parent7e23e7448c84914c9edadacfa171a8c1110aa2c1 (diff)
Clarified error condition when there are no snapshots but not enough space.
-rwxr-xr-xbyteback-prune8
1 files changed, 5 insertions, 3 deletions
diff --git a/byteback-prune b/byteback-prune
index f93b8c5..b3afe42 100755
--- a/byteback-prune
+++ b/byteback-prune
@@ -90,9 +90,6 @@ debug("Disc free #{@free}%, 30m gradient = #{gradient_30m}")
def snapshots_in_order
list = BackupDirectory.all_snapshots
- if list.empty?
- warn("Couldn't find any snapshots (yet?)")
- end
if @order == 'importance'
Snapshot.sort_by_importance(list)
elsif @order == 'age'
@@ -124,5 +121,10 @@ exit 0 unless File.exists?(PRUNING_FLAG) && @do_prune
exit 0 unless @do_prune_force || gradient_30m == 0
+if snapshots.empty?
+ error("No snapshots to delete, is there enough disc space?")
+ exit 1
+end
+
info("Deleting #{snapshots.last.path}")
log_system("sudo btrfs subvolume delete #{snapshots.last.path}")