Created
July 19, 2011 12:04
-
-
Save simaob/1092102 to your computer and use it in GitHub Desktop.
Backup config file for db_name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Begin Whenever generated tasks for: backups | |
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games | |
32 11 * * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name.rb >> ~/Backup/log/whenever_cron.log 2>&1' | |
0 0 1 12 * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_yearly.rb >> ~/Backup/log/whenever_cron.log 2>&1' | |
0 0 1 * * /bin/bash -l -c 'backup perform -t db_name -c ~/Backup/db_name_monthly.rb >> ~/Backup/log/whenever_cron.log 2>&1' | |
# End Whenever generated tasks for: backups |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backup::Model.new(:db_name, 'Backup db_name Production db') do | |
## | |
# PostgreSQL db_name | |
# | |
database PostgreSQL do |db| | |
db.name = "[db_name]" | |
db.username = "[db_username]" | |
db.password = "[db_password]" | |
db.host = "localhost" | |
db.port = 5432 | |
end | |
## | |
# Amazon Simple Storage Service [Storage] | |
store_with S3 do |s3| | |
s3.access_key_id = '[s3_access_key]' | |
s3.secret_access_key = '[s3_secret_access_key]' | |
s3.region = '[s3_region]' | |
s3.bucket = '[s3_bucket]' | |
s3.path = '/daily' #/monthly, /yearly | |
s3.keep = 30 | |
end | |
## | |
# Gzip [Compressor] | |
# | |
compress_with Gzip do |compression| | |
compression.best = true | |
compression.fast = false | |
end | |
## | |
# Mail [Notifier] | |
# | |
notify_by Mail do |mail| | |
mail.on_success = true | |
mail.on_failure = true | |
mail.from = 'db_backup@domain' | |
mail.to = '[email protected]' | |
mail.address = 'localhost' | |
mail.port = 25 | |
mail.domain = 'domain' | |
mail.user_name = nil | |
mail.password = nil | |
mail.authentication = 'plain' | |
mail.enable_starttls_auto = true | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this file to easily define all of your cron jobs. | |
# | |
# It's helpful, but not entirely necessary to understand cron before proceeding. | |
# http://en.wikipedia.org/wiki/Cron | |
# Example: | |
# | |
env :PATH, "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" | |
set :output, "~/Backup/log/whenever_cron.log" | |
["db_name"].each do |db| | |
every 1.day, :at => '11:32 am' do | |
command "backup perform -t #{db} -c ~/Backup/#{db}.rb" | |
end | |
every 1.month do | |
command "backup perform -t #{db} -c ~/Backup/#{db}_monthly.rb" | |
end | |
every 12.month do | |
command "backup perform -t #{db} -c ~/Backup/#{db}_yearly.rb" | |
end | |
end | |
# Learn more: http://github.com/javan/whenever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment