summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-22 03:58:29 +0000
committerMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-22 03:58:29 +0000
commit43565976272f53e9db7943e2d505b55790337693 (patch)
treec98983aca29b8a6c1545c78aa79a722a64d0eccc
parent6c945d3a9399639bfa9119c26d7dab6238f15543 (diff)
Another fix for the case when first snapshot is being taken.
-rwxr-xr-xbyteback-snapshot11
1 files changed, 7 insertions, 4 deletions
diff --git a/byteback-snapshot b/byteback-snapshot
index 0f0c9e9..d3645b5 100755
--- a/byteback-snapshot
+++ b/byteback-snapshot
@@ -26,11 +26,14 @@ end
fatal("--root not readable") unless File.directory?("#{@root}")
@backups = BackupDirectory.new(@root)
+snapshots = @backups.snapshots
-last_snapshot_time = @backups.snapshots.last.time
-fatal("Last snapshot was less than six hours ago") unless
- !last_snapshot_time ||
- Time.now - last_snapshot_time >= 6*60*60 # FIXME: make configurable
+if !snapshots.empty?
+ last_snapshot_time = snapshots.last.time
+ fatal("Last snapshot was less than six hours ago") unless
+ !last_snapshot_time ||
+ Time.now - last_snapshot_time >= 6*60*60 # FIXME: make configurable
+end
info "Making new snapshot"
@backups.new_snapshot!