LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Automatically Start Dropbox at Login (http://www.linuxquestions.org/questions/slackware-14/automatically-start-dropbox-at-login-4175445954/)

tifcg 01-16-2013 09:49 PM

Automatically Start Dropbox at Login
 
Hello... I am trying to figure out how to automatically start Dropbox at login (not startup). I am running Slackware 14 and using bash shell. The command that I use to start Dropbox is:

~/.dropbox-dist/dropboxd

When I issue this command while I'm logged in it works fine.

I tried putting it in my /etc/rc.d/rc.local but when I rebooted it would continually error indicating that an account was not setup.

Is there a way to make it start when I log in?

mina86 01-17-2013 01:52 AM

Add the following to your ~/.bashrc file (if it does not exist, create it):
Code:

ps ax | grep -q 'dropbox[d]' || ~/.dropbox-dist/dropboxd

bijo505 01-17-2013 03:16 AM

Hi Tifcg,
Add the entry in ~/.bash_profile, so it will executed after you login.
Just have a look at the following URL
http://www.thegeekstuff.com/2008/10/...d-bash_logout/

bijo505 01-17-2013 03:45 AM

Quote:

Originally Posted by mina86 (Post 4871947)
Add the following to your ~/.bashrc file (if it does not exist, create it):
Code:

ps ax | grep 'dropbox[d]' || ~/.dropbox-dist/dropboxd

Hi Mina86,
If you add it in .bashrc, it will be executed every time if you open a new shell or subshell. So if we want to execute only one time after the user login, add the entry in ~/.bash_profile or .bash_login

PS:- .bash_login will check only if .bash_profile not exist on the user home directory.

Habitual 01-17-2013 02:15 PM

Quote:

Originally Posted by tifcg (Post 4871859)
I tried putting it in my /etc/rc.d/rc.local but when I rebooted it would continually error indicating that an account was not setup.

Is there a way to make it start when I log in?


Try it without the "~" in rc.local
Code:

/path/to/.dropbox-dist/dropboxd

tifcg 01-17-2013 03:13 PM

I don't have a ~/.bash_profile so I created one in my home directory and chmod it to 755. I added the ~/.dropbox-dist/dropboxd to it and rebooted but it didn't startup. I read the link http://www.thegeekstuff.com/2008/10/...d-bash_logout/ and it gave an example of the /etc/profile but it looks completely different than mine and I can't see where it would call the .bash_profile file. I am running bash shell though.

tifcg 01-17-2013 08:31 PM

I was able to get it to work by creating rc.dropbox and editing rc.local. See the link below for the details. The link didn't mention that you have to chmod 755 the rc.dropbox and that the "username" variable refers to your local account name on the Linux box and not your Dropbox username.

http://henrysnotes.org/?p=589

mina86 01-18-2013 03:31 AM

Quote:

Originally Posted by bijo505 (Post 4872010)
If you add it in .bashrc, it will be executed every time if you open a new shell or subshell. So if we want to execute only one time after the user login, add the entry in ~/.bash_profile or .bash_login

That's why there's ps and grep which guarantees that the daemon is started unless it's already running.

Quote:

Originally Posted by tifcg (Post 4872446)
I don't have a ~/.bash_profile so I created one in my home directory and chmod it to 755.

You don't have to make it executable.

Quote:

Originally Posted by tifcg (Post 4872446)
I added the ~/.dropbox-dist/dropboxd to it and rebooted but it didn't startup.

Yeah, it won't start after reboot, but only once you log in.

Quote:

Originally Posted by tifcg (Post 4872446)
I can't see where it would call the .bash_profile file.

The file is automatically read by bash.

bijo505 01-18-2013 04:33 AM

Quote:

Originally Posted by mina86 (Post 4872724)
That's why there's ps and grep which guarantees that the daemon is started unless it's already running.

I understand that.. but why you want to add the entry in bashrc. We need to run that only once after the user login to the system.... not to run every time if the user go to a subshell or new console tab. If you add that in bashrc, it will check that every time, if the user open a tab or new shell. So .bash_profile is the best place for that script.

mina86 01-18-2013 06:24 AM

Quote:

Originally Posted by bijo505 (Post 4872753)
I understand that.. but why you want to add the entry in bashrc. We need to run that only once after the user login to the system.... not to run every time if the user go to a subshell or new console tab. If you add that in bashrc, it will check that every time, if the user open a tab or new shell. So .bash_profile is the best place for that script.

Why not? Also, it will restart the daemon should it die for whatever reason. Point is, it does not really matter that much.

414N 01-18-2013 06:47 AM

Why don't you put a script launching the dropboxd daemon OR a .desktop file pointing to it under your ~/.config/autostart directory?
It was designed for these kind of tasks without resorting to other tricks...

bijo505 01-18-2013 06:50 AM

Quote:

Originally Posted by mina86 (Post 4872810)
Why not? Also, it will restart the daemon should it die for whatever reason. Point is, it does not really matter that much.

Hi Mina86,
Try to understand the concept instead of arguing....I am stopping this. Your method is good, but what I am suggesting is that use the same code in .bash_profile instead of .bashrc.

godblessyouiam 12-25-2013 06:11 PM

You can edit ~/.xprofile, add this line at the end:
~/.dropbox-dist/dropboxd &

Note: the '&' is very important, otherwise you will be blocked when starting your desktop.


All times are GMT -5. The time now is 02:47 AM.