How to use Dropbox or Google Drive on multiple Linux (Ubuntu) boxes to organize and sync scripts

Posted on Updated on

Dropbox and Google Drive (with Insync) – let’s just call them “Netdrives” – are great ways to sync files across multiple linux (Ubuntu) machines.

  •  Utterly reliable sync
  •  Online login to get your files from anywhere
  •  Great mobile support
  •  Can be used headless on linux servers
  •  Cross platform (Mac, PC, Linux)

When it comes to using them as a repo for scripts though they have inherant issues. They don’t retain file attributes.. so you create a file on one machine, chmod +x and it gets synced to all other machines, but without the +x.


  •  Ubuntu One.. but every time I try it I walk away thinking it’s not really an option at all. Why can’t Ubuntu get this right!
  •  NFS mounts. A good option if everythings on the same Lan, but what if it’s not?
  •  sshfs mounts. I still love sshfs mounts for certain things, but not when I want persistency.
  •  Github.. a bit clunky.

So, here’s what I do to solve this issue. A BETTER way (and I’ll blog that soon) is to use incrond inotify, but here’s a quick and easy way that works well and is really painless.

1) Put all the files in the same place.
I use /Dropbox/config/bin for Bash files

2) Create two files that do the “work” for you.
You need two files. One of which you actually have to chmod +x yourself at some point, but it’s not a file that will EVER change.

I use /Dropbox/config/bin/worker as a file that has the job of making sure all other files in this tree are executable

chmod -R +x $HOME/Dropbox/config/bin

Note that it launches the file worker2

Here’s MY worker2


It just launches something that I want to run often. The reason for worker2 is that you can modify worker2 from any machine, and worker will make it executable just before executing it.

3) Use Cron to run worker as often as you like.

* * * * * export DISPLAY=:0.0 && export XAUTHORITY=/home/keith/.Xauthority && sudo -u keith /home/keith/Dropbox/config/bin/worker

I run it every minute.. because I want that pulse_check (makes sure all my stuff is healthy) to run every minute anyway. Note the overly complex way that this is called in cron. All that XAUTHORITY stuff on a Ubuntu box means that if notify-send (create desktop notifications) can be used in anything downstream launched by worker, and they show up on the desktop.

That’s it! It’s not rocket science, and in a way it’s a bit ghetto – but it works well.