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
Code: Select all
git clone https://github.com/andreafabrizi/Dropbox-Uploader/
Here is a simple perl script. Enter in the required information and save it as .pl (I named mine backupscript.pl)
Code: Select all
#!/usr/bin/perl -w
use strict;
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);
Code: Select all
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.
Code: Select all
my $backup_folder =
Code: Select all
my $path =
Code: Select all
my $bu_prefix
Code: Select all
my $target_folder =
Once everything is setup you should be able to run your script. For myself I did.
Code: Select all
perl backupscript.pl
Go to https://www.dropbox.com/developers/apps/create and create the the following.
Database App
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!