4

After looking around online it seems pretty easy to have multiple dropbox accounts running. All you have to do is change an environmental variable and then run dropbox. However, I've tried editing the .desktop file (see .desktop file specification) so the Exec line is changed from this:

Exec=dropbox start -i

which is the default, to this:

Exec=env "HOME\=/home/reg/.dropbox-alt" dropbox start -i

which from everything I have read should work. I've also tried all the variations of escaping and quoting like:

Exec=env HOME\=/home/reg/.dropbox-alt dropbox start -i
Exec=env "HOME=/home/reg/.dropbox-alt" dropbox start -i
Exec=env HOME=/home/reg/.dropbox-alt dropbox start -i

and nothing seems to launch dropbox. However if I try the same line in bash it tries to launch but falls short but that's only because dropbox is looking for a GUI. That being the case I would have thought that doing the above in the .desktop file would work but I get nothing at all happening.

I'm doing this without any dropbox instances running already so it cannot be that dropbox is looking for other instances and stopping itself from loading another instance.

If I try this in the .desktop file:

Exec=env dropbox start -i

It will launch dropbox but now it's the default instance which has no benefit.

Can anyone tell me what I'm missing to make this work?

user5429087
  • 139
  • 2
  • 10

3 Answers3

4

Open a terminal and paste the following commands:

$ mkdir "$HOME"/.dropbox-alt
$ ln -s "$HOME/.Xauthority" "$HOME/.dropbox-alt/"
$ HOME="$HOME/.dropbox-alt"
$ /home/$USER/.dropbox-dist/dropboxd

Dropbox setup wizard window will appear. Finish the setup similarly as described in Method -1

start Dropbox from terminal

$ /home/$USER/.dropbox-dist/dropboxd

start Alternate-Dropbox from terminal

$ HOME="$HOME/.dropbox-alt" && /home/$USER/.dropbox-dist/dropboxd

Note:

You can create a small script with the above commands to start Dropbox.
One can put the script at startup. Don't forget to give the script execution permission.

chmod +x /path/to/script

I have tested the second method. Hope it will be useful.
Meiram Chuzhenbayev
  • 898
  • 1
  • 10
  • 26
  • This works which is great but I really wanted to know how to make it work using the desktop file type. I've got a refinement on this method I'll post shortly. – user5429087 Jun 06 '16 at 08:06
2
#!/bin/bash

HOME_DIR=$HOME
DROPBOXES=("$HOME/.dropboxes/personal" "$HOME/.dropboxes/business")
function start_dropbox() {
  HOME=$HOME_DIR
  local flag
  local home_dir
  local OPTIND;
  local verbose=0
  local wait=0

  while getopts p:vw opt; do
    case $opt in
      p) home_dir="$(echo $OPTARG | sed 's:/*$::')/" ;;
      v) verbose=1 ;;
      w) wait=1 ;;
      *) ;;
    esac
  done
  shift $((OPTIND-1))

  # Test if the process is already running
  local pid=$(ps aux|grep "${home_dir}.dropbox-dist"|grep -v 'grep'|tr -s ' '| cut -d' ' -f 2)
  if [ -n "$pid" ]
  then
    echo "Process already running with home dir. of: $home_dir"
    return 8 # Process already running
  fi

  # Create home directory if it doesn't exist
  if [ ! -e "$home_dir" ]
  then
    if mkdir -p "$home_dir";
    then
      echo "Created directory: $home_dir"
    else
      echo "Failed to create directory: $home_dir"
      return 9 # Failed
    fi
  fi

  # Set up so works with GUI from command line
  xauthority="${home_dir}.Xauthority"
  if [ ! -e "$xauthority" ]
  then
    ln -s "$HOME/.Xauthority" "$xauthority"
  fi

  HOME="$home_dir"

  # Start the dropbox daemon
  if [[ $verbose -gt 0 ]]; then
    echo '~/.dropbox-dist/dropboxd & '$home_dir
  fi
  ~/.dropbox-dist/dropboxd &
  if [[ $wait -eq 0 ]]; then
    sleep 2 # Give each instance time to startup completely before starting another one
  else
    read -n 1 -s -p 'Press any key to continue.'
    echo
  fi
}

function start_dropboxes() {
  local dropbox

  for dropbox in "${DROPBOXES[@]}"
  do
    start_dropbox $@ -p "$dropbox"
  done
}

#
# For testing & setup we can choose just one to startup
#
while getopts f:wv opt; do
  case $opt in
    f) start_dropbox -p "${DROPBOXES[$OPTARG]}" # NOTE: bash array indexes start at 0.
       exit ;;
    *) ;;
  esac
done
OPTIND=1

start_dropboxes $@
user5429087
  • 139
  • 2
  • 10
-1

Not being able to install multiple instances of same software on a single machine is a typical case of what is called as Software Conflict where two such instances would compete for resources such as memory, peripheral device, register, network port, etc.

However, we could use a container-based virtualization technology called as Docker to run multiple instances of a software on the same machine in loosely isolated environments called as Containers.

The best part of this solution is that it would work on any platform, as containers are meant to portable.

I recently wrote a blog on it, explaining steps to containerise dropbox instances using docker.

iamsmkr
  • 800
  • 2
  • 10
  • 29