From bf5aecde3d5c8094a35e85ee37e933657f314933 Mon Sep 17 00:00:00 2001 From: Matthew Bloch Date: Sat, 22 Nov 2014 02:56:25 +0000 Subject: Clarified error condition when there are no snapshots but not enough space. --- byteback-prune | 8 +++++--- 1 file 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}") -- cgit v1.2.1