How are you automating making backups of your production db?
- Bitbutter
- Posts: 32
- Starts: 14
- Wiki Edits: 2
I'm considering hacking together some kind of script triggered by cron, but first i wanted to ask what others are doing. How are you backing up your production db? anything to watch out for? (code examples would be superb too if you have the time!)
- William
- Posts: 1061
- Starts: 32
- Wiki Edits: 56
There is a wiki thread on this
http://www.hostingrails.com/forums/wiki_thread/22
Its a good script to FTP your database somewhere else, too. (optional) --
http://www.hostingrails.com/forums/wiki_thread/22
Its a good script to FTP your database somewhere else, too. (optional) --
2007-06-15 07:56 AM
- Bitbutter
- Posts: 32
- Starts: 14
- Wiki Edits: 2
ah thanks
Will this task keep on adding new backup files everyday and keep all of them?
If so i was wondering if it might be best to keep only the latest x backups and delete the others (for disk space reasons).
Will this task keep on adding new backup files everyday and keep all of them?
If so i was wondering if it might be best to keep only the latest x backups and delete the others (for disk space reasons).
2007-06-15 09:50 AM
- Kumar
- Posts: 454
- Starts: 0
- Wiki Edits: 5
Hello,
After the line "cd /home/username/backup" you can add the follwoing line to delete all your backups older that 3 days.
After the line "cd /home/username/backup" you can add the follwoing line to delete all your backups older that 3 days.
find . -mtime +3 -exec rm {} \;This deletes all the files older than 3 days under the directory backup
2007-06-15 10:13 AM
HostingRails Support- Bitbutter
- Posts: 32
- Starts: 14
- Wiki Edits: 2
Perfect, thankyou!
2007-06-15 10:32 AM
- Adamwest
- Posts: 16
- Starts: 12
- Wiki Edits: 0
thanks you very much, such a useful script
2007-06-21 05:55 PM
- Des
- Posts: 2
- Starts: 2
- Wiki Edits: 0
- Location: Ukraine
>This deletes all the files older than 3 days under the directory backup
What about FTP? How can I delete old backups there?
What about FTP? How can I delete old backups there?
2007-09-03 01:54 AM
Ruby.on-page.net – the simplest Ruby manual- Kumar
- Posts: 454
- Starts: 0
- Wiki Edits: 5
Hello,
You wont able to execute this command via FTP. You need to have a cron job set on the FTP server to delete the files that are older than 3 days.
You wont able to execute this command via FTP. You need to have a cron job set on the FTP server to delete the files that are older than 3 days.
2007-09-03 05:36 AM
HostingRails Support- Hardbap
- Posts: 3
- Starts: 3
- Wiki Edits: 0
If you have an irrational fear of shell scripts like I do you can use Rake + Amazon S3:
http://www.rubyinside.com/advent2006/15-s3rake.html (updated code here: http://www.railsenvy.com/assets/2007/6/19/s3_rake_tasks.zip)
I found both of these at the RailsEnvy Rake tutorial: http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial#useful_resources
http://www.rubyinside.com/advent2006/15-s3rake.html (updated code here: http://www.railsenvy.com/assets/2007/6/19/s3_rake_tasks.zip)
I found both of these at the RailsEnvy Rake tutorial: http://www.railsenvy.com/2007/6/11/ruby-on-rails-rake-tutorial#useful_resources