Backing up your database with a cron job on Bluehost
Bluehost provide a cron job set up interface in the control panel that makes it easy to set up cron jobs. The command I use is:
mysqldump -u DBUSERNAME --password=DBPASSWORD DBNAME
I've then set it up to run this once every day. All it does is email all the sql commands I would need to restore my database in the body of an email.
You don't have to run it every day and you could run other commands. For example you could run a php script that emailed your database to you as an attachment. The command would be something like this:
wget -q http://yourdomain.com/phpmysqlautobackup/run.php
Obviously it doesn't matter where the php file is located.
About
Paul is a web developer for Kyanmedia web agency. He's lucky enough to write in Ruby on Rails full-time and uses this site to post snippets of code.
Contact
my name at gmail.com
More snippets
Take a look in the archive
Need a website?
Contact my employer. Make sure to check out our portfolio of work.
Hosting
I recommend hostingrails.com
No comments have been left
Got something to say?