summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-05 14:28:42 +0000
committerMatthew Bloch <mattbee@yoga.home.bloch.tv>2014-11-05 14:28:42 +0000
commitceb4dfa6003071c8dd5d21417bf26c2701ddb8d8 (patch)
tree26235c1bbf66e0df165d99a4ffa90de8e63c14f6
parentc88333e19b459685f57ba3f246c3fdd684681542 (diff)
A few more bug fixes from the last refactoring.
-rwxr-xr-xbyteback-receive11
-rwxr-xr-xbyteback-snapshot4
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!