Page 1 of 3 123 LastLast
Results 1 to 10 of 24

Thread: Dropbox system-tray silencer

  1. #1
    QwUo173Hy is offline Grande Half-n-Half Cinnamon Ubuntu
    Join Date
    Feb 2006
    Location
    Ireland
    Beans
    867
    Distro
    Ubuntu

    Lightbulb Dropbox system-tray silencer

    Important! : If you're a linux newbie, or unsure about the methods I'm using, then wait until someone replies with a post saying that it all worked for them. I've tested all this out on Ubuntu 9.10 (Karmic Koala) running Dropbox version 0.6.571. This tutorial assumes you have dropbox already installed from https://www.dropbox.com/install

    I use dropbox to keep synced with my colleagues on projects we are working on. But I really don't like having the icon in the system-tray all the time. At the moment, there is no option to hide it - so I've written a script that starts dropbox and performs any syncing that needs to be done. Then it exits leaving your system-tray nice and tidy again!

    I have this happen automatically at login, because I boot my machine regularly enough. But you can also have it happen more regularaly using cron. Below, I will describe how to install the script and set it to run at login as well as optional intervals using cron.

    Installation
    Just download the script attached at the end of this post and place it wherever you like. First of all, we need to make it executable:

    Code:
    chmod +x check-dropbox.sh
    I like to keep the file 'hidden' in my home folder so I saved it there and renamed it with this command:
    Code:
      mv check-dropbox.sh .check-dropbox.sh
    The dot in front of the name makes it hidden. So now the file is called .check-dropbox.sh


    Making it run at login
    Go to System -> Preferences -> Startup Applications.
    Click the Add button.
    Type in any name for this, and click Browse...
    In the new dialog that appears, click the right mouse button and select 'Show Hidden Files' so that you can find the file if you used the Installation method I described earlier.
    Then just click Add and also Close in the main window.


    Making it run every fifteen minutes
    Open a new terminal and backup the file /etc/crontab before we continue. We will be editing this file.

    Code:
     cp /etc/crontab ~
    Next we want to add a single line to the correct location in this file to make our script run regularly. In the terminal type:

    Code:
     sudo gedit /etc/crontab
    The file will look very like this in Ubuntu Karmic:
    Code:
    # /etc/crontab: system-wide crontab
    # Unlike any other crontab you don't have to run the `crontab'
    # command to install the new version when you edit this file
    # and files in /etc/cron.d. These files also have username fields,
    # that none of the other crontabs do.
    
    SHELL=/bin/sh
    PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
    
    # m h dom mon dow user	command
    17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
    25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    #
    We want to add this line, replacing the two instances of <username> with your username:
    Code:
    */15 * * * * <username> /home/<username>/.check-dropbox.sh
    Copy that line above and paste it just under where it says: "# m h dom mon dow user command". On my computer that portion of the file looks like this: (our new part is highlighted in red)

    Code:
    # m h dom mon dow user	command
    */15 * * * * jarlath /home/jarlath/.check-dropbox.sh
    17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
    25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
    47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
    52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
    #
    Save and close. Enjoy!

    Credits

    Thanks to diesch for helping me with a coding problem I had.
    The commands I use in this script can be found in the following:
    Dropbox man page - type 'man dropbox' in a terminal (for the 'dropbox status' command)
    Newbies intro to cron - (for information on editing the crontab file to automate script or command execution)
    And Advanced Bash Scripting guide - (for all the rest! script programming in general is covered here.)
    Attached Files Attached Files
    Last edited by QwUo173Hy; February 24th, 2010 at 04:17 AM. Reason: Fixed typo

  2. #2
    Join Date
    Oct 2008
    Beans
    255
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Dropbox system-tray silencer

    thank you very much for this tip, I was looking for something like this.

  3. #3
    QwUo173Hy is offline Grande Half-n-Half Cinnamon Ubuntu
    Join Date
    Feb 2006
    Location
    Ireland
    Beans
    867
    Distro
    Ubuntu

    Re: Dropbox system-tray silencer

    You're very welcome raktarok.

  4. #4
    Join Date
    Nov 2009
    Beans
    1

    Re: Dropbox system-tray silencer

    thank you very much,it's helpful to me.

  5. #5
    Join Date
    Apr 2009
    Beans
    2

    Re: Dropbox system-tray silencer

    Thanks mate. This is well needed on a netbook.

  6. #6
    QwUo173Hy is offline Grande Half-n-Half Cinnamon Ubuntu
    Join Date
    Feb 2006
    Location
    Ireland
    Beans
    867
    Distro
    Ubuntu

    Re: Dropbox system-tray silencer

    liangzzzzzzz, lpfan076 - you're very welcome. I'm glad you find it useful.

  7. #7
    Join Date
    Jul 2007
    Location
    Salt Lake City, Utah
    Beans
    487
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Dropbox system-tray silencer

    Just heard about this and must say thanks! I don't like having a lot of icons up there, especially when dropbox's icon stays the same size no matter the size of the gnome-panel with no way to hide it.

  8. #8
    Join Date
    Jul 2009
    Beans
    5

    Talking Re: Dropbox system-tray silencer

    thanks for this great script and for giving a noob like me a heads up about the cron

  9. #9
    QwUo173Hy is offline Grande Half-n-Half Cinnamon Ubuntu
    Join Date
    Feb 2006
    Location
    Ireland
    Beans
    867
    Distro
    Ubuntu

    Re: Dropbox system-tray silencer

    Thank you for the feedback. I've discovered a bug with the behavior of the script. Today the script exited without updating my files - so I need to investigate.

    In the mean-time, anyone using this script should run dropbox normally:
    Code:
    dropbox start
    until I fix it.

  10. #10
    QwUo173Hy is offline Grande Half-n-Half Cinnamon Ubuntu
    Join Date
    Feb 2006
    Location
    Ireland
    Beans
    867
    Distro
    Ubuntu

    Re: Dropbox system-tray silencer

    The problem seems to have been with dropbox - the native application was also misbehaving and now both are fine. The problem manifests when your bandwith is blocked up - for example, someone on the network filesharing heavily.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •