Skip to content

Instantly share code, notes, and snippets.

@nhed
Last active December 30, 2015 15:16
Show Gist options
  • Save nhed/771e3af4d0182d5c9ab3 to your computer and use it in GitHub Desktop.
Save nhed/771e3af4d0182d5c9ab3 to your computer and use it in GitHub Desktop.
Dropbox upstart to start for all users that have linked their account (dropbox assumed installed, home assumed in /home)

Upstart config for dropbox

Why? So it runs even if not logged in

Prereq:

  • Download and install dropbox (packages from https://www.dropbox.com/install?os=lnx)
  • Run dropboxd once in your terminal (you will see a URL to paste to your browser where already logged in so that you can link this new machine). After linking is succesful - kill with -

Usage:

  • Drop these two files (as root) into /etc/init
  • Reload config: sudo initctl reload-configuration
  • Start service: sudo start dropbox

Notes/Caveats:

  • This config assumes the standard home dir is under /home and is named exactly like the user
  • Not sure why a copy is made of dropbox in user space
description "dropbox instance"
stop on stopped dropbox
instance ${DROPBOX_USER}
respawn
respawn limit 10 5
exec su ${DROPBOX_USER} /home/${DROPBOX_USER}/.dropbox-dist/dropboxd
# EOF
description "Dropbox (multi user)"
start on (started networking)
stop on (stopping networking)
pre-start script
for CFG in /home/*/.dropbox/info.json ; do
USR=$(echo "${CFG}"|sed 's@/home/\([^/]*\).*$@\1@')
start dropbox-usr DROPBOX_USER=${USR}
done
end script
# EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment