One of the common problems when using a Webhosting is the way to backup databases, CPanel provides a manual way to get your databases… but too many clicks for such small task. If you have SSH access for your hosting account, you can use the following bash script to backup your databases easily and store them in dropbox.

  1. Connect to your hosting via SSH
  2. look for a suitable location for your script (do not place this script within the public_html folder unless you want to share your mysql password), I recommend your /home/USERNAME folder.
  3. Paste the following code and provide execution permission on the script
  4. This scripts requires the Dropbox_Uploader script made by Andrea Fabrizi, you can grab the script from his site.
  5. Run the Dropbox_Uploader script and perform the first-time setup. It’s easy, just follow the instructions on screen and you will be able to send data to a dropbox account.
  6. Via cpanel, you can set a cron job a follows:
    0 0,12 * * * /home/USERNAME/dbbackup.sh
  7. Now if everything is setup correctly, this baby will save you database in dropbox at noon and at midnight

Follow me

Carlos Alberto Umanzor Arguedas

Web Developer at carlosumanzor.com
Web Developer, QA Engineer and Gamer Enthusiast, Developer of Linkcrawler and Father of a future computer ninja.
Follow me

Pin It on Pinterest

Shares
Share This
Optimization WordPress Plugins & Solutions by W3 EDGE