Skip to content

Instantly share code, notes, and snippets.

@STRd6
Created May 26, 2011 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save STRd6/992483 to your computer and use it in GitHub Desktop.
Save STRd6/992483 to your computer and use it in GitHub Desktop.
Backup you db to s3, brah.
namespace :backup do
task :database do
AWS::S3::Base.establish_connection!(
:access_key_id => '123',
:secret_access_key => '456'
)
database = "pixie_production"
file = 'dump.sql'
`pg_dump #{database} -U postgres > #{file}`
AWS::S3::S3Object.store("#{database}_#{Time.now.iso8601}", open(file), 'pixie.strd6.com')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment