Dropbox Daemon Management for KDE

Dropbox in KDE does not offer the same level of integration with the file manager, dolphin, as it does with its gnome equivalent so I installed it and settled on choosing the dropbox daemon whenever I required to run dropbox as opposed to running it every time on startup. This gradually became a pain so I wrote a handy script that can start or stop dropbox easily. I placed this in a binary directory in my home directory.

~/bin

you can make with
mkdir ~/bin

In debian , this is automatically added to to the path via an if clause in the ~/.profile file like so.

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi

If for some reason it is different for your distribution you can just add the directory to your path by adding the above if statement to you ~/.profile or adding

export PATH=$PATH:~/bin

at the end of the ~/.profile file.

once done you can reload your .profile by typing


source ~/.bash_profile

Alternatively, if you like saving keystrokes you can type . ~/.bash_profile

Now save the code below to a file called dropbox in the ~/bin directory.
Change the permissions to make it executable
chmod u+x ~/bin/dropbox

now on a terminal you can type dropbox to start the daemon or the stop the daemon. Optionally you could add it to a gui menu.

#!/bin/sh
#script to start or stop the dropbox daemon
#Usage: simply type dropbox to start or stop the dropbox daemon

#check if daemon is already running
procs=`ps aux | grep -i "dropbox-dist" |grep -v grep | wc -l`

if [ "$procs" -eq "1" ];

then
echo "Stopping dropbox daemon"

killall dropbox

echo "daemon stopped"

exit

else

echo "Starting Dropbox Daemon . . "

~/.dropbox-dist/dropboxd &

echo "Running . ."

exit
fi

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s