Thursday, August 7, 2014

Running 2 Instance of Dropbox under Ubuntu

Have you ever wanna run 2 instance of Dropbox (2 different account) at the same time, syncing both account's files at the same time? You can find the guide for Windows here. As for Ubuntu, I will try to share the method I found and use.

Dropbox is a powerful software to allow files syncing, and sharing between devices, and users. Me myself owned 2 Dropbox account, one for personal use (sharing files between computer and devices), and another one for my work (sharing files between colleague).

Step 1: Install Dropbox in Ubuntu. There are many ways to do this, but I personally recommend going through Ubuntu Software Center. You can simply open Ubuntu Software Center, search for "dropbox" and click Install. It might take a few minutes, and you should have your Dropbox running.


Step 2: Create Shell Script to start multiple instance of Dropbox. You do not need to continue with the Dropbox configuration, or if you already have a Dropbox setup and running, just "quit" it. Create a .sh file, and store it somewhere. (I found this method from this page here, the original code provided do not work on ubuntu 14.04, and I edit some part of it)

The content of the .sh file:
#!/bin/bash
dropboxes=".dropbox-1 .dropbox-2"
for dropbox in $dropboxes
do
    HOME="/home/$USER"
    if ! [ -d "$HOME/$dropbox" ]
    then
        mkdir "$HOME/$dropbox" 2> /dev/null
        ln -s "$HOME/.Xauthority" "$HOME/$dropbox/" 2> /dev/null
    fi
    HOME="$HOME/$dropbox"
    /var/lib/dropbox/.dropbox-dist/dropboxd 2> /dev/null &
done

Step 3: Add the .sh file to be executed automatically on startup. You can go to your Startup Application list, and you should find a Dropbox in the list by default. Edit it and replace the command with the execution of your .sh file. For example I store my .sh file under "/mnt/Data/Software/ubuntu/SH/" folder, and the name of the .sh file is "dropbox.sh"


So, my edited Startup Application Command:


Step 4: Reboot and setup both Dropbox instance. Upon reboot, if everything is in order, you will have 2 instance of Dropbox setup running. I have no Idea how to know which are which, I just simply insert my first account to the 1st one that pop out. After setting up both account, you should have 2 dropbox syncing at the background.


So far both account is syncing properly, no crash, no issue. The only downside of this method is there is no way to know which icon is for which account, the way to overcome this is to store both "Dropbox" folder at 2 known places. To access the folder simply use file explorer to browse to the directory for each account. 

Also take note that, there is no way to edit the name of the main syncing folder. It has to be always "Dropbox", and this will prevent putting both account's folder on the same folder. 

No comments:

Post a Comment