diff options
author | Matthew Bloch <matthew@bytemark.co.uk> | 2014-01-06 02:19:54 +0000 |
---|---|---|
committer | Matthew Bloch <matthew@bytemark.co.uk> | 2014-01-06 02:19:54 +0000 |
commit | c138effe83fe68234d9f630b62b52c3fdfdaca6a (patch) | |
tree | 2d44db957098eff9e73a3b09785413a2467d7b3a /byteback | |
parent | 103d4e4278feed14dc5cf732d9c9875220cb8eff (diff) |
First commit of working code, needs a lot more writing and testing
Diffstat (limited to 'byteback')
-rw-r--r-- | byteback | 65 |
1 files changed, 65 insertions, 0 deletions
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 <mode> + +Modes: + server-setup + client-setup + backup + backup-receive + +Type 'bytebackup help <mode>' 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 |