I have an Ubuntu 14.04 server and I am trying to start Apache Karaf from a ssh, exit the ssh and expect Karaf to remain execting. What I actually find is that as soon as the last ssh is closed/logged out, the Karaf process is terminated.
I start Karaf with the bin/start command as described here (background mode) and the docs state that this should put Karaf into the background mode, however my experience has shown this does not happen. As soon as I logout of ssh, the process dies.
I have tried using 'nohup' but again the karaf process is always killed once the last ssh is closed. I don't believe this is a problem with Karaf but some configuration of Ubuntu. I also see the same behaviour on Linux Mint.
However, Karaf DOES run as a backgorund process if I run it on a RaspberryPi, which is running Raspbian.
Is there a configuration of sshd that forces all processes started in a ssh to terminated once ALL ssh connections are ended? Whatever I try I cannot make a background process remain once I have logged out.
UPDATE
Looking at the start
script it uses exec
:
exec "$KARAF_HOME"/bin/karaf server "$@" >> "$KARAF_REDIRECT" 2>&1 &
and thus another process is created. If I just do a bin/start
file descriptors 0,1 and 2 are all directed toward `/dev/null'.
If I do nohup ./start 0<&- &>/dev/null &
followed by a disown
, then fd 0,1,2 of the resultant process all go to /dev/null
. I noted on the RaspberryPi that fd 0,1 and 2 all state /dev/pts/0 (deleted)