From ceb4dfa6003071c8dd5d21417bf26c2701ddb8d8 Mon Sep 17 00:00:00 2001 From: Matthew Bloch Date: Wed, 5 Nov 2014 14:28:42 +0000 Subject: A few more bug fixes from the last refactoring. --- byteback-receive | 11 +++-------- byteback-snapshot | 4 ++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/byteback-receive b/byteback-receive index e6e7798..f93dfd3 100755 --- a/byteback-receive +++ b/byteback-receive @@ -8,12 +8,7 @@ $LOAD_PATH << '/usr/lib/byteback' require 'trollop' -def error(message) - STDERR.print "*** #{message}\n" - exit 1 -end - -#STDERR.print "ARGV=#{ARGV.inspect}\nSSH_ORIGINAL_COMMAND=#{ENV['SSH_ORIGINAL_COMMAND']}\n" +#debug "ARGV=#{ARGV.inspect}\nSSH_ORIGINAL_COMMAND=#{ENV['SSH_ORIGINAL_COMMAND']}\n" if ENV['SSH_ORIGINAL_COMMAND'] ARGV.concat(ENV['SSH_ORIGINAL_COMMAND'].split(" ")) @@ -22,10 +17,10 @@ end #STDERR.print "after ARGV=#{ARGV.inspect}\n" byteback_host = ENV['BYTEBACK_HOST'] -error("BYTEBACK_HOST environment not set") unless byteback_host +fatal("BYTEBACK_HOST environment not set") unless byteback_host byteback_root = ENV['HOME'] + "/" + ENV["BYTEBACK_HOST"] -error("#{byteback_root} does not exist") unless File.directory?(byteback_root) +fatal("#{byteback_root} does not exist") unless File.directory?(byteback_root) # force destination to be where we expect # diff --git a/byteback-snapshot b/byteback-snapshot index a14e0f8..0f0c9e9 100755 --- a/byteback-snapshot +++ b/byteback-snapshot @@ -27,10 +27,10 @@ fatal("--root not readable") unless File.directory?("#{@root}") @backups = BackupDirectory.new(@root) -last_snapshot_time = @backups.snapshot_times.last +last_snapshot_time = @backups.snapshots.last.time fatal("Last snapshot was less than six hours ago") unless !last_snapshot_time || - Time.now - @backups.snapshot_times.last >= 6*60*60 # FIXME: make configurable + Time.now - last_snapshot_time >= 6*60*60 # FIXME: make configurable info "Making new snapshot" @backups.new_snapshot! -- cgit v1.2.1