Skip to content

Instantly share code, notes, and snippets.

@realflash
Created March 15, 2018 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realflash/80b92f5892e1aecdd17d859c5838996f to your computer and use it in GitHub Desktop.
Save realflash/80b92f5892e1aecdd17d859c5838996f to your computer and use it in GitHub Desktop.
Run multiple dropboxes on Linux, and restart them if they exit.
#!/bin/bash
# CREATE THIS AS $HOME/bin/dropbox_personal/run
dropbox=".dropbox_personal"
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"
dropbox start 2>&1 | tee /tmp/${dropbox}.log
#!/bin/bash
# CREATE THIS AS $HOME/bin/dropbox_work/run
dropbox=".dropbox_work"
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"
dropbox start 2>&1 | tee /tmp/${dropbox}.log
#!/bin/bash
# CREATE THIS AS $HOME/bin/supervise_dropboxes.sh
# INSTALL daemontools package to get `supervise`
dropboxes="dropbox_personal dropbox_work"
for dropbox in $dropboxes
do
supervise $HOME/bin/$dropbox &
done 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment