Home How To How to backup your Ubuntu VPS to DropBox

How to backup your Ubuntu VPS to DropBox

by Unallocated Author

In this tutorial we are going to see how to backup your Ubuntu VPS to DropBox storage account automatically. This method is tested using the last version of Ubuntu 16.04. And make sure you have a DropBox account before you get started.

How to:

Step 1: Create a DropBox free trail account.
Step 2: Click open DropBox developer link and click “Create App” button and then select DropBox APIIn the section titled “2. Choose the type of access you need” select: App folderAccess to a single folder created specifically for your app.
Step 3: Now enter a name and Accept the Terms and Conditions and then click “Create App“. On the next page click “Generate” button under the section titled “Generate access token”, take note of the code and keep it since we will be using after some time.

Now you need to configure your VPS. Connect to your VPS and enter the following commands given below:

sudo apt-get install curl


mkdir dropbox


cd dropbox


curl “https://raw.githubusercontent.com/andreafabrizi/Dropbox-Uploader/master/dropbox_uploader.sh” -o dropbox_uploader.sh


chmod 755 dropbox_uploader.sh



When you run the script for first time, it will ask you to customize your install. You need to enter Access Token that we generate in previous steps. After few steps, we need to test is everything is OKAY, now try to upload the dropbox_uploader.sh script itself.

./dropbox_uploader.sh -k upload dropbox_uploader.sh

Now open your DropBox account and you should see the application folder and inside of it a folder with the name of your app.

Now you enter the following lines into the new file:

vim backup.sh


DATE=$(date +”%d-%m-%Y_%H%M”)
BKP_DIRS=”/var/www ”
tar cf “$BKP_FILE” $BKP_DIRS
gzip “$BKP_FILE”
$DROPBOX_UPLOADER -f /root/.dropbox_uploader upload “$BKP_FILE.gz” /
rm -fr “$BKP_FILE.gz”

Now give execution permission:

chmod 755 backup.sh

And the last step is to add the following line to the crontab:

00 00 * * * /path/to/backup.sh 2>&1 >> /var/log/backup.log

Make sure that you clean up some of the older files since your DropBox account is not limitless.

You may also like

Latest Hacking News