blob: e89cd38042cc0a61842c2f120d522080c0684fca (
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
|
#!/usr/bin/env ruby
# Log to STDOUT if in Rails
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') && ENV.include?('RAILS_LOG_SQL')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
DUMP_CMD = '/usr/bin/mk-parallel-dump'
require(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
dbc = Cve.configurations[RAILS_ENV]
opts = []
opts << '-u' << dbc['username']
opts << '-p' << dbc['password']
if dbc.include?('socket') then
opts << '-S' << dbc['socket']
else
opts << '-h' << dbc['host']
opts << '--port' << dbc['port'] if dbc.include?('port')
end
opts << '--databases' << dbc['database']
cmd = ([DUMP_CMD]+opts+ARGV).join(' ')
#print "#{cmd}\n"
exec cmd
# vim: ts=2 sw=2 et ft=ruby sts=2 tw=72 nospell:
|