The restore did more damage than the crash...
April 10, 2009 6:30 AM Subscribe
Looking to automate the backup and download of mySQL tables on a cPanel webhost to an external FTP site.
posted by GJSchaller to Computers & Internet (6 answers total)
I have an account with a web hosting provider that is running cPanel. I also have a local FTP server in my home (an old G4 Mac running Fedora) that works nicely. I already have a PHP script in place that runs via CRON job, and once a week, it backs up the ENTIRE cPanel account and FTPs it down to my server here, so I have an offsite copy no more than a week old at all times.
Recently, an issue on the server with another user's website spilled over and caused mySQL to crash hard, and corrupted one of my databases. Of course, this happened the night before the backup was due to kick off, so restoring would have rolled us back a week, and the forums on my website would have lost a LOT of important posts that were made in that time. My provider was able to restore the DB from 24 hours before the crash, but in doing so, they also restored all of my other DBs, causing a minor loss of data (again, at a critical time).
Is there a way to script a command, such as using PHP, that will dump, gzip, and FTP down a specified database when run, which I can then set up via CRON job to run daily? Backing up the site daily is not an option, it's almost 2 Gigs in size due to photo content. Or, is there another solution to back up the DBs automatically that I am missing? The applications are Joomla 1.0.15, SMF 1.1.8, and Gallery2.3 if that helps.