Have some Dropbox space free? Want to keep backups of all your important server files? Well you have come to the right place!
For my tutorial I will be doing this on Ubuntu 13.04, however with some basic Linux knowledge you should be able to adapt this for almost any Linux deployment.
Now first of all we will need to install Dropbox itself from the official website. This is pretty straight forward and works well on Debian. I am not going to go into detail on how to compile from source. If you need to compile from source I would hope you already have that knowledge.
For me I downloaded the 32 bit .deb and it opened up automatically in Ubuntu Software Center. It was as easy as a few clicks.
After Ubuntu Software Center was finished I was prompted with a notification on the desktop requesting to open Dropbox and download more required files.
From there log into Dropbox and go through the general config. The Linux version of Dropbox is great and runs just like the Windows version.
Now that we have Dropbox setup we need need to get this really cool Bash script "Dropbox Uploader". This script does use curl so you will want to check that you have curl installed.https://github.com/andreafabrizi/Dropbox-Uploader
I used the instructions on the github to download the file to my home directory. It will create a directory named Dropbox-Uploader
git clone https://github.com/andreafabrizi/Dropbox-Uploader/
Now we need to make a script that can easily call our bash script that we just downloaded. So open up a text editor and lets start scripting.
Here is a simple perl script. Enter in the required information and save it as .pl (I named mine backupscript.pl)
use POSIX qw(strftime);
my $time = strftime "%Y-%m-%d_%H-%M-%S", localtime;
my $backup_folder = "/home/furntree/srcds";
my $path = "/home/furntree/Dropbox-Uploader/";
my $bu_prefix = "furntree";
my $script = "dropbox_uploader.sh";
my $exe = $path . $script;
my $filename = $bu_prefix . "_" . "backup_" . $time . ".tgz";
my $tar = "/bin/tar";
my $rm = "/bin/rm";
my $target_folder = "/LocalBackup/" . $filename;
system($tar . " -cvzf " . $path . $filename . " " . $backup_folder);
system($exe . " upload " . $path . $filename . " " . $target_folder);
system($rm . " " . $path . $filename);
What this script does.
Performs tar on the directory you wish.
Executes the upload using the bash script.
Removes the temporary tarball from the disc.
These are the things you will need to worry about.
my $backup_folder =
What directory you want backed up. (In this example I am backing up a directory I might use for a Valve game)
my $path =
The location of our upload bash script.
What you want your backups named.
my $target_folder =
The folder you want uploaded to on Dropbox itself.
Once everything is setup you should be able to run your script. For myself I did.
The first time the script runs you will be asked to create an application with the Dropbox API.
Go to https://www.dropbox.com/developers/apps/create
and create the the following.
Files and datastores
App not limited or App folder (I did not limited)
All file types
Use the app name given to you in console.
Enter in the information given to you by Dropbox and follow all instructions you see. Once the setup is complete you can run your perl script again and it should work! From here you can add the script to Cron to run everyday, week, etc. Making automatic backups easily available offsite.If you run into any problems or have suggestions on how to improve this post below!