Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: df547b23fe
Fetching contributors…

Cannot retrieve contributors at this time

executable file 21 lines (15 sloc) 0.578 kB
#!/usr/bin/env ruby
require "common"
begin
FileUtils.mkdir_p @temp_dir
dump_file = "#{@temp_dir}/#{Date.today.to_s}.dump.sql.gz"
cmd = "mysqldump -u#{@mysql_user}"
cmd += " -p'#{@mysql_password}'" unless @mysql_password.nil?
cmd += " --host=#{@mysql_host}"
cmd += " #{@mysql_database} | gzip > #{dump_file}"
run(cmd)
AWS::S3::S3Object.store(File.basename(dump_file), open(dump_file), @s3_bucket)
AWS::S3::S3Object.delete("#{(Date.today - (@backups_to_keep * @backup_runs_every)).to_s}.dump.sql.gz", @s3_bucket)
ensure
FileUtils.rm_rf(@temp_dir)
end
Jump to Line
Something went wrong with that request. Please try again.