Ubuntu Server 11.10
When a normal (non-root) user starts a process with nohup (nohup java … &), when the user disconnects from the terminal (ssh) the process stops responding. When the user connects again, the process starts responding again.
For example the process is a database (H2) which stops responding queries when the user that started the process disconnects from the terminal, and starts responding again when the user logs in again.
Is there any background process permissions that I'm not aware of that precludes the process from running in background?
What could be causing this behaviour?
Best Answer
nohup
should work for you, what was your exact command? Maybe you're missing something. Here's section from wikipedia about it:So you could do something like:
Or if that still doesn't work, you can try
screen
. It will allow you to run your process in the "background", and it will keep running after you logout.First,
ssh
over to the remote box, then from there usescreen
and start your process, and you can give yourscreen
a session name if you want. You won't really notice anything different, but start your process in that session. You can than exit out of thescreen
session by using the commandCtrl-a d
. It will look something like this:You can then exit out of your ssh session, and the process will keep running. To reconnect to the
screen
session later on, ssh back to the remote box and usescreen -r
to reconnect. You can usescreen -ls
to list the sessions.