LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-16-2013, 09:49 PM   #1
tifcg
LQ Newbie
 
Registered: Jan 2013
Posts: 18

Rep: Reputation: Disabled
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?
 
Old 01-17-2013, 01:52 AM   #2
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
Add the following to your ~/.bashrc file (if it does not exist, create it):
Code:
ps ax | grep -q 'dropbox[d]' || ~/.dropbox-dist/dropboxd

Last edited by mina86; 01-18-2013 at 03:32 AM.
 
Old 01-17-2013, 03:16 AM   #3
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
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/

Last edited by bijo505; 01-17-2013 at 03:49 AM.
 
Old 01-17-2013, 03:45 AM   #4
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Quote:
Originally Posted by mina86 View Post
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.
 
Old 01-17-2013, 02:15 PM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by tifcg View Post
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
 
Old 01-17-2013, 03:13 PM   #6
tifcg
LQ Newbie
 
Registered: Jan 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-17-2013, 08:31 PM   #7
tifcg
LQ Newbie
 
Registered: Jan 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
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
 
Old 01-18-2013, 03:31 AM   #8
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by bijo505 View Post
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 View Post
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 View Post
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 View Post
I can't see where it would call the .bash_profile file.
The file is automatically read by bash.
 
Old 01-18-2013, 04:33 AM   #9
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Quote:
Originally Posted by mina86 View Post
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.
 
Old 01-18-2013, 06:24 AM   #10
mina86
Member
 
Registered: Aug 2008
Distribution: Debian
Posts: 517

Rep: Reputation: 229Reputation: 229Reputation: 229
Quote:
Originally Posted by bijo505 View Post
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.
 
Old 01-18-2013, 06:47 AM   #11
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 647

Rep: Reputation: 189Reputation: 189
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...
 
Old 01-18-2013, 06:50 AM   #12
bijo505
Member
 
Registered: Nov 2012
Location: Bangalore
Distribution: Fedora & Ubuntu
Posts: 77

Rep: Reputation: 18
Quote:
Originally Posted by mina86 View Post
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.
 
Old 12-25-2013, 06:11 PM   #13
godblessyouiam
LQ Newbie
 
Registered: Dec 2008
Posts: 1

Rep: Reputation: 0
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.

Last edited by godblessyouiam; 12-25-2013 at 06:13 PM. Reason: because of my poor english:(
 
Old 03-25-2016, 01:26 PM   #14
rkfb
Member
 
Registered: Oct 2003
Location: Guildford, England
Distribution: Slackware64 15.0 running i3
Posts: 494

Rep: Reputation: 174Reputation: 174
Just to say if anyone happens across this thread (as I did) while searching for an answer to this very question, the code suggested does work if added to .bash_profile but you need to make sure there is a '&' at the end, thus:

Code:
ps ax | grep -q 'dropbox[d]' || ~/.dropbox-dist/dropboxd &
Worked for me in fluxbox. Without the '&' I would hit enter and it would hang without logging in. Luckily I was ssh'd in so I could make the adjustment.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I get fluxbox to start automatically at login allele Linux - Software 4 08-16-2009 02:59 PM
start application automatically after login gcomandini Linux - Newbie 4 02-06-2008 02:33 AM
FLWM + YaST start automatically at Root Login ibex Linux - General 1 05-30-2006 02:01 AM
Login user automatically on system startup, and then start X locodude Linux - Security 1 02-26-2006 05:02 PM
Mandrake Control Centre tries to start automatically everytime I login pwilkie Mandriva 3 02-27-2005 02:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration