Your VPS is likely to have no backups (which makes them cheaper). However, this doesn’t mean you shouldn’t have your own backup. If your provider allows you to have snapshots of your server, that might be helpful, but it will cause your server to be offline for a few seconds whenever you want a backup. If you aren’t using your VPS for a crowded site, this wouldn’t be much of a problem. But if you can’t have any downtime in anyway, then backing your VPS to Dropbox is a great way to have easy and automated backups. For this, we’ll need two things. (Some of the following commands assumes you are using Ubuntu/Debian. If you are using another linux distro, use another command to install the mentioned software.)

1. Dropbox Uploader script by Andrea Fabrizi. We’ll need to download it from here. The installation instructions are also on the website. The file will walk you through the setup. Simply run apt-get update. Then run apt-get install curl.

2. Use the following bash script. The script was originally written by Dave Hope. But I’m guessing it was written for an earlier version Dropbox Uploader and it required you to fill Dropbox login information. Since Dropbox Uploader does the authentication using an API key, you don’t really need that. With my limited knowledge of bash, I modified Dave Hope’s script into the following, it does the trick for me. Save the following as dropboxbackup.sh and do a chmod +x dropboxbackup.sh and put it in the same folder as Dropbox Uploader sh file. If you don’t have it already, installing an easy to use text editor might also be useful. Simply type apt-get install nano to have Nano installed.

3. After we arrange and config all the stuff, we should now test it. Simply run your dropboxbackup.sh and test if it works. If it successfully starts uploading your backup file, you can now set a cronjob to automate the process. Depending on how active you are on the site, you might want to change the frequency of the backup. Also think of the bandwidth you are going to use each time you take a backup. To easily create a cronjob, go to generateit.net and follow the instructions.

What about the database? Well, I take regular backups of my MySQL databases using things like WordPress plugins designed for this. But you can make changes to the script above by looking at Dave Hope’s script, or simply googling cronjob mysqldumb, etc. Good luck and let me know if this works for you!