Wednesday, December 8, 2010

Fixing Dropbox startup issues in Ubuntu

I am a big Dropbox fan, no use hiding it. I use several machines on a daily basis, including Windows XP and 7, as well as a plethora of Linux distros. Dropbox is a solid thread that links them all, helping me make sense of the whole thing while keeping all my data safe and centralised. Dropbox has truly influenced the way I work these days, making my life easier in many ways.

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:

dropbox status

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.sh and 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!

6 comments:

  1. This happening to me. I will try your script. Thank you ;)

    ReplyDelete
  2. Thanks for fix the dropbox issue, this is good.

    ReplyDelete
  3. Glad to be of help, let me know how it works for you!

    ReplyDelete
  4. Thanks - will give it a shot. Any idea why there is a delay from when I save something to DropBox on one computer (XP/Vista Laptop/Ubuntu) to it being available to one of the other 3 - all within my house?

    ReplyDelete
  5. Well, hard to say without an understanding of what you consider "delay", but let me just clarify that the fact that all your computers are close to each other is completely irrelevant.

    When you save anything in your Dropbox folder, it has to be uploaded to the server (which is usually the bit that takes longer, specially if you have an asynchronous connection), then downloaded to the rest of the machines.

    Once again, not sure if you are talking about a significant delay here, but it sounds like you are just experiencing what is to be expected.

    ReplyDelete
  6. I am new to Dropbox and this happened to me too.
    I did not know what to do but I changed few folders and slept on it.
    I use couple of Linux boxes.
    Without much a do it reconfigured itself.
    It is probably has something to do with the internet connection (upload / download speeds, I believe) which is painfully slow in this part of the world.
    I use Dropbox to deposit (one or two at a time) the 100 odd Linux images I downloaded this year for my friends to share.
    After all this is Christmas and it is the time for giving and sharing.
    All what you need is the Dropbox Registration and your email stating that you wish to share Linux iso images.

    It is like exchanging stamps we used to do as kids.

    I have only 2.5 GiB and I cannot deposit big games images.

    It is my ultimate goal (I have not done it yet. it takes 4 days to download a DVD).
    In reverse the Guys in the Western Hemisphere who have Tetrabytes of spare, space can deposit few games images in their Dropboxes and let some of us here share the benefits of Cloud Computing.
    I am going to vote Dropbox as number one and Wordpress as number two in annual web awards.
    Pleas spread the goodwill of Dropbox to kids too.
    Contact me personally by email (I will do manually one at a time) if you wish to share Linux Live Images.

    ReplyDelete