summaryrefslogtreecommitdiff
path: root/byteback
blob: 7418006d0da82dfdf5bb4ae97e42fef51342c417 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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