2

I tried every solution from How to run Dropbox daemon in background? and nothing solves my problem:

Basically, I already installed dropbox on my Ubuntu 12.04LTS headless server. I got init.d setup but the problem is that right now I cannot restart the server (other users are using it actively).

So I am trying to start dropbox via SSH which works and dropbox starts to sync, but as soon as I disconnect from SSH dropbox stops runnning. I tried running it on a detached screen, using ($HOME/.dropbox-dist/dropboxd &)& and they all stop when I log out from SSH.

I tried doing service start but it seems not to work and I don't know why..?

$ sudo service dropbox start
[sudo] password: 
Starting dropbox...
$ dropbox status
Dropbox isn't running!

I followed the instructions:

sudo chmod +x /etc/init.d/dropbox 
sudo update-rc.d dropbox defaults

from http://www.dropboxwiki.com/tips-and-tricks/install-dropbox-in-an-entirely-text-based-linux-environment#debianubuntu and I got no error messages. Please help.

I don't care as much about starting the process at server restart, as long as I can launch dropbox via ssh and keep it runnning after i log out.

Thank you

UPDATE & ANSWER: thanks a lot for all your answers. Thanks to user Nixgrrrl's comment, I realize that it was because I was using ssh -X (the default on my system). As soon as I did normal ssh, trying the humble dropbox start & worked :)

  • You can also do a disown -a after. – slm Jul 22 '15 at 18:10
  • `nohup $HOME/.dropbox-dist/dropboxd &

    disown` didn't work: after i logout from SSH it stops dropbox :( note: disown was on another line (another command from the first one)

    – newmathwhodis Jul 22 '15 at 18:52
  • I remember wrestling w/ dropbox like this too. I wrote up this A over on SO: http://stackoverflow.com/questions/7708715/check-if-program-is-running-with-bash-shell-script/9271229#9271229. Notice how I start dropbox there: dropbox start -i > /dev/null. Does that help here? Try starting it like that and backgrounding it and then disowning it or running it w/ nohup. I don't use dropbox anymore really so have no way to replicate this now. – slm Jul 23 '15 at 06:04
  • 1
    I have been fighting this problem since I rebuilt my OS. I found out that if I disabled X11-tunneling in the SSH session, that dropbox will start and continue to run after I log off. It's like the process attaches to X11 and when I close out of the ssh session, it kills it. Hope this helps someone else . . . –  Dec 10 '15 at 00:27
  • Oh, that is very interesting. My ssh is by default using X, so maybe that's why nothing worked!! Thanks! – newmathwhodis Dec 10 '15 at 17:46

3 Answers3

3

Have a look here:

https://community.spiceworks.com/topic/131973-dropbox-headless-workstation?page=1#entry-6076539

A user mentioned:

Just thought I'd mention:

(a) the latest distributions seem to make this fairly straightfoward, just run dropbox start from the command line, BUT (b) watch out for logging in and out with X11 forwarded.

I've set up a lot of Bash aliases for connecting to various machines, and they all include the -X option to forward X11 packets. Because of this, Dropbox kept dying on my on logout, even running it under screen and with nohup. Apparently, having X11 forwarded was causing Dropbox to connect the dbus process on my local machine rather than on the remote machine; so, when I broke the connection, Dropbox was seeing dbus as having terminated and thus was terminating itself.

Just FYI, as this stumped me for a bit. The key was that I was having to press Ctrl-C even after logging out / running exit on the remote machine. Apparently, SSH was keeping the session open, even though I had exited Bash, because of the remaining open connection.

The solution is simple even if one (for some reason) wants to keep ssh-ing with the -X: before launching Dropbox you should "break" the forwarding for example doing:

$ unset DISPLAY

If this is done in a Bash script the forwarding is "broken" just inside the script but once this is executed the 'terminal' is still forwarding.

slm
  • 369,824
1

Best solution would be to find the problem that avoids server starting from service dropbox start. Check your logs to see what's happened.

But in the mean time, you can start your daemon with nohup, that will keep it running after you logout.

nohup $HOME/.dropbox-dist/dropboxd &

YoMismo
  • 4,015
  • thank you but nohup $HOME/.dropbox-dist/dropboxd & didn't work. same problem: as soon as I log out from SSH it kills dropbox. Where would the logs be please? – newmathwhodis Jul 22 '15 at 17:44
  • Start with /var/log, if no logs are there and dropbox is started as an unprivileged user, logs may be in your home directory. By the way, did you follow dropbox's installation guide? http://www.dropboxwiki.com/tips-and-tricks/install-dropbox-in-an-entirely-text-based-linux-environment – YoMismo Jul 23 '15 at 06:43
0

thanks a lot for all your answers. Thanks to user Nixgrrrl's comment, I realize that it was because I was using ssh -X (the default on my system). As soon as I did normal ssh, trying the humble dropbox start & worked :)