Changing files from my Dropbox folders is something that happens many times a day, so it is critical for me to keep its daemon running at all times while I work. Because of that, I find it annoying when randomly, for no apparent reason, it does not properly start in Ubuntu/Linux Mint. Basically, Dropbox remains in a "Connecting..." status forever, forcing me to manually stop and start the service.
I decided to put together a short and simple script that fixes this problem, checking Dropbox status after a number of seconds and then restarting the service automatically if necessary. I have configured the script to sleep for 30 seconds before running a status check, but you may change that figure to suit your machine/network setup.
HOW DOES IT WORK?
In case you don't know, Dropbox for Linux provides a simple command line interface. Dropbox status may be checked upon at any time using the following command:
From what I have gathered, there are four possible states, namely:
- Idle: Dropbox is running fine, in standby status until any potential synchronization is required.
- Downloading file list: Dropbox just connected to the server and is gathering information.
- Connecting...: Dropbox is trying to connect to the server. This is usually the status it is at when the problem appears. Instead of going into Idle status, Dropbox remains in Connecting status.
- Dropbox isn't running!: Pretty self explanatory.
My script loads on startup, just like the Dropbox daemon does. As I mentioned already, the script will allow 30 seconds before checking Dropbox status. If the check returns status Idle or Downloading file list, the script will do nothing and let Dropbox do its thing. Any other status will display some GUI messages, then restart Dropbox.
I added a couple screenshots below to show how the script works.
After 30 seconds, the script checked and found that Dropbox was not running. It then displayed a simple message informing the user that the Dropbox daemon would be restarted. Once the user clicks OK, the restart takes place and a confirmation message appears.
WANNA USE IT?
If you have experienced the same strange random Dropbox behavior yourself, you may find this script interesting and want to use it. If so, it is real simple, just follow these easy steps:
1.- Download the script from HERE.
2.- Save it as
CheckDropbox.shand then grant it execution privileges.
3.- Finally, configure it to run on startup. Go to Main menu > System > Preferences > Startup Applications and create a new entry pointing to the script.
4.- Exit your current session and login again, or simply reboot for the script to take effect.
I hope this little script helps you too in getting rid of that little Dropbox connection annoyance.
Thanks for reading!