From c138effe83fe68234d9f630b62b52c3fdfdaca6a Mon Sep 17 00:00:00 2001 From: Matthew Bloch Date: Mon, 6 Jan 2014 02:19:54 +0000 Subject: First commit of working code, needs a lot more writing and testing --- byteback | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 byteback (limited to 'byteback') diff --git a/byteback b/byteback new file mode 100644 index 0000000..7418006 --- /dev/null +++ b/byteback @@ -0,0 +1,65 @@ +#!/usr/bin/ruby +# +# byteback backup script prototype +# +# (c) Bytemark Hosting 2013 +# +# +VERSION='prototype' + +HOSTNAME=`hostname -f` + +mode = ARGV.shift +case mode +when 'backup' + + @destination_host = HOSTNAME.split(".")[2..-1].join(".") + + system *<<-CMD.split(/\s+/) + +rsync + + --rsync-path + rsync --fake-super + --rsh + ssh -i /etc/bytebackup/bytebackup.key + --delete + --one-file-system + --archive + --exclude + /swap.file + + / + + #{@destination_ssh} + + CMD +when 'backup-receive' + +else + print <<-SYNTAX +byteback v#{VERSION}, a focused backup tool + +Usage: byteback + +Modes: + server-setup + client-setup + backup + backup-receive + +Type 'bytebackup help ' for more information on a mode, or +see the man page. + SYNTAX + exit 1 +end + +require 'trollop' +opts = Trollop::options do + opt :mode, "Program mode to run", + :default => :backup, + :required, + :type => String + + opt +:end \ No newline at end of file -- cgit v1.2.3