I am using Rails 4 with Mysql2 as a database in Windows.I want to take auto backup of my database every second. So that there should be folder generated at every second in the path which i specify and also an email must be sent along with database as an attachment.I used whenever gem for this purpose but i am unable to get what i must write in my schedule.rb file.
schedule.rb file every :day, :at => '12:05am' do rake 'task_namespace:autobackup' , :environment => 'development', :output => 'log/autobackup_mail.log' # rake 'task_namespace:autobackup_with_mail' , :environment => 'development', :output => 'log/autobackup.log' end
you can use the gem Backup.
Backup is a system utility for Linux and Mac OS X, distributed as a RubyGem, that allows you to easily perform backup operations. It provides an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.
you can visit: http://backup.github.io/backup/v4/database-mysql/
Backup allows you to model your backup jobs using a Ruby DSL:
Backup::Model.new(:my_backup, 'Description for my_backup') do
# ... Model Components ...
end
The :my_backup symbol is the model's trigger and used to perform the job:
$ backup perform --trigger my_backup
it also support PostgreSQL, MongoDB, Redis, Riak, SQLite
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.