backup-agent 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/backup-agent.gemspec +1 -1
- data/lib/backup-agent/performer.rb +13 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d42e667623d611480fdc1638183fdf82830b443d
|
4
|
+
data.tar.gz: 1d459ac8a430ecb419720fc204e6330d23d3b614
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70ff610698ab230b39e1deb3e0e3816f76991a87f3a8a3ccedf344ef7f17f73e81a412ba6a0ddc54b88e0175e062126577fac4a688bdbf83fa215f6b9081ef4f
|
7
|
+
data.tar.gz: 376d0edce3a0d55e36e3db9e2929bdf01a1b4e3024445ce50e4a4f76773a7119865ff2a8739aa7e86c86c660ce3788a101d3b3535f0bad1c435c557f8b411288
|
data/backup-agent.gemspec
CHANGED
@@ -23,8 +23,9 @@ module Backup
|
|
23
23
|
|
24
24
|
def backup_directories
|
25
25
|
config.get(:directories).each do |name, dir|
|
26
|
-
dir_filename
|
27
|
-
|
26
|
+
dir_filename = "#{name}.tar.gz"
|
27
|
+
dir_fileparam = Shellwords.escape(dir_filename)
|
28
|
+
cmd = "cd #{dir} && /usr/bin/env tar -czf #{tmp_path}/#{dir_fileparam} ."
|
28
29
|
puts "Exec #{cmd}"
|
29
30
|
system(cmd)
|
30
31
|
storage.upload("#{@timestamp}/#{dir_filename}", "#{tmp_path}/#{dir_filename}")
|
@@ -34,13 +35,14 @@ module Backup
|
|
34
35
|
def backup_files
|
35
36
|
config.get(:files).each do |name, files|
|
36
37
|
begin
|
37
|
-
files_tmp_path
|
38
|
-
file_bunch_name
|
38
|
+
files_tmp_path = File.join(tmp_path, "#{name}-tmp")
|
39
|
+
file_bunch_name = "#{name}.tar.gz"
|
40
|
+
file_bunch_param = Shellwords.escape(file_bunch_name)
|
39
41
|
|
40
42
|
FileUtils.mkdir_p(files_tmp_path)
|
41
43
|
FileUtils.cp(files.select { |el| File.exists?(el) }, files_tmp_path)
|
42
44
|
|
43
|
-
cmd = "cd #{files_tmp_path} && /usr/bin/env tar -czf #{tmp_path}/#{
|
45
|
+
cmd = "cd #{files_tmp_path} && /usr/bin/env tar -czf #{tmp_path}/#{file_bunch_param} ."
|
44
46
|
system(cmd)
|
45
47
|
|
46
48
|
storage.upload("#{@timestamp}/#{file_bunch_name}", "#{tmp_path}/#{file_bunch_name}")
|
@@ -52,9 +54,10 @@ module Backup
|
|
52
54
|
|
53
55
|
def backup_mysql
|
54
56
|
config.get(:mysql_databases).each do |db|
|
55
|
-
db_filename
|
57
|
+
db_filename = "MySQL Database #{db}.gz"
|
58
|
+
db_fileparam = Shellwords.escape(db_filename)
|
56
59
|
dump = with_env "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} #{db}"
|
57
|
-
gzip = with_env "gzip -5 -c > #{tmp_path}/#{
|
60
|
+
gzip = with_env "gzip -5 -c > #{tmp_path}/#{db_fileparam}"
|
58
61
|
|
59
62
|
puts "Exec #{dump} | #{gzip}"
|
60
63
|
system "#{dump} | #{gzip}"
|
@@ -68,10 +71,11 @@ module Backup
|
|
68
71
|
FileUtils.mkdir_p(mongo_dump_dir)
|
69
72
|
|
70
73
|
config.get(:mongo_databases).each do |db|
|
71
|
-
db_filename
|
74
|
+
db_filename = "Mongo Database #{db}.tar.gz"
|
75
|
+
db_fileparam = Shellwords.escape(db_filename)
|
72
76
|
dump = with_env "mongodump #{config.get(:mongo_connect)} -d #{db} -o #{mongo_dump_dir}"
|
73
77
|
cd = "cd #{mongo_dump_dir}/#{db}"
|
74
|
-
tar = with_env "tar -czf #{tmp_path}/#{
|
78
|
+
tar = with_env "tar -czf #{tmp_path}/#{db_fileparam} ."
|
75
79
|
|
76
80
|
puts "Exec #{dump} && #{cd} && #{tar}"
|
77
81
|
system "#{dump} && #{cd} && #{tar}"
|