One problem I’ve been having is that sometimes the Dropbox process seems to die, I tried several different scripts to keep track of the status of dropbox via the dropbox.py python scripts but I eventually found this bash script to work. I’ve set it as an hourly cron job in /etc/cron.hourly and it’s working well so far.
Basically we get the status output from dropbox.py, if it says it isn’t running then we start it otherwise we output it’s current status. In both cases an email is sent out to show the current status, perhaps a bit much information but I want to keep track of Dropbox and make sure that it’s running consistently
Here’s the BASH script, note that I have displayed one ‘echo’ line on three lines here to display it on the page correctly but this should all be on a single line:
STATUS=`/root/bin/dropbox.py status` echo $STATUS if [ "$STATUS" = "Dropbox isn't running!" ]; then # if no then start it... # (the following 3 lines should all be on a single line! echo "Dropbox.py was not running, trying to restart..." | mail -s "Dropbox.py was not running, trying to restart..." your@emailaddress.com echo "Dropbox.py was not running, trying to restart..." /root/bin/dropbox.py start else echo "$STATUS" | mail -s "$STATUS" your@emailaddress.com echo "$STATUS" fi
Obviously this is only of use to you if you have already installed the Dropbox CLI version but I’ll leave that to your own Googling to find out how to do. You will also need to make sure that the correct install location of your ‘dropbox.py’ is referenced in the script, for me it was in ‘/root/bin/’ but change this in the script as appropriate.