Rake task for backing up MySQL database
It is often a good idea to do backups, right?
ActiveRecord doesn’t provide a straight task to do them, so I have written a small rake task to achieve that.
This task automatically cleans up old backups.
Additionally, it offers two additional variables to define max number of backups left and the directory name to place the backups.
To use it, place the code inside lib/tasks/backup.rake.
Your code looks remarkably like code written by Craig Ambrose and posted in 2007. Coincidence?
http://blog.craigambrose.com/articles/2007/03/01/a-rake-task-for-database-backups