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.
Step 1: Create a DropBox free trail account.
Step 2: Click open DropBox developer link and click “Create App” button and then select DropBox API. In the section titled “2. Choose the type of access you need” select: App folder – Access 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
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:
#!/bin/bash TMP_DIR=”/tmp/” DATE=$(date +”%d-%m-%Y_%H%M”) BKP_FILE=”$TMP_DIR/MyBkp_$DATE.tar” BKP_DIRS=”/var/www ” DROPBOX_UPLOADER=/path/to/dropbox_uploader.sh 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.
Latest posts by Unallocated Author (see all)
- Tips How To Recover Deleted Files on Windows PC Free and Easily - October 8, 2018
- iKeyMonitor Android Tracking App Review - September 4, 2018
- “Open Sesame” Vulnerability That Let Users Hack Windows 10 Was Demonstrated at Black Hat Conference - August 12, 2018