backup-agent 1.0.7 → 1.0.8
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 +14 -7
- 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: 820a15a09fd0413a06a73500bee8889cf9dba6a5
|
4
|
+
data.tar.gz: ad4d69b45552d4a52a462eec64e507e64c15873b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b311d7a0c1bf67cf4f25de10eaa271d3238e75bb350775c611523876fcb2795d79c229668c953b4cd9857418ab6bdf0d7fe62294d83e4d1c549ee8da45ef04b1
|
7
|
+
data.tar.gz: dd45244140b0445f76337991825a3bacfe660885acf52f2a70c86d8ea2a685abb7b7283a3a0508b42b1fc9b02f2e3032a4b5d578cdf20b9091940af26d11df21
|
data/backup-agent.gemspec
CHANGED
@@ -54,15 +54,13 @@ module Backup
|
|
54
54
|
|
55
55
|
def backup_mysql
|
56
56
|
config.get(:mysql_databases).each do |db|
|
57
|
-
|
58
|
-
|
59
|
-
dump = with_env "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} --databases #{db}"
|
60
|
-
xz = with_env "xz --compress --extreme -9 --keep --threads=0 --verbose --stdout"
|
57
|
+
dump_path = "#{tmp_path}/#{ shell_escape(db) }.sql"
|
58
|
+
dump_cmd = "mysqldump #{config.get(:mysql_connect)} #{config.get(:mysqldump_options).join(' ')} --databases #{db}"
|
61
59
|
|
62
|
-
|
63
|
-
|
60
|
+
exec with_env("#{dump_cmd} > #{dump_path}")
|
61
|
+
exec with_env("xz --compress --extreme -9 --keep --threads=0 --verbose #{dump_path}")
|
64
62
|
|
65
|
-
storage.upload("#{@timestamp}/#{
|
63
|
+
storage.upload("#{@timestamp}/#{ shell_escape(db) }.sql.xz", "#{dump_path}.xz")
|
66
64
|
end
|
67
65
|
end
|
68
66
|
|
@@ -108,5 +106,14 @@ module Backup
|
|
108
106
|
def with_env(cmd)
|
109
107
|
"/usr/bin/env #{cmd}"
|
110
108
|
end
|
109
|
+
|
110
|
+
def shell_escape(x)
|
111
|
+
Shellwords.escape(x)
|
112
|
+
end
|
113
|
+
|
114
|
+
def exec(cmd)
|
115
|
+
puts "Exec #{cmd}"
|
116
|
+
system cmd
|
117
|
+
end
|
111
118
|
end
|
112
119
|
end
|