How to disconnect a running bash job from the shell in Linux?
Posted
by
raven
on Super User
See other posts from Super User
or by raven
Published on 2012-12-10T07:42:45Z
Indexed on
2012/12/10
11:11 UTC
Read the original article
Hit count: 330
I have a script that starts a server on a remote VM. All works great until I close the shell where I executed the script. When the shell closes, so does the server. After some looking around I found the following:
&
will send the job to the background when executed with the symboldisown -h
will disconnect the job from the shell and allow it to run regardless of the shell.
The command I used is:
./startServer.sh nasb_wxscat160_catalog-4.1.6 1.0.8 > catalog-log.txt & disown -h
When I closed the shell and checked using ps -ef | grep java
to see if the job is still working I did see it in the list. However when I tried to connect to the server it was unresponsive.
On deeper inspection, the log file was filled just until I closed the shell and using the ps -m
flag I say the process jobs were not working.
Has any one encountered some thing of this sort?
© Super User or respective owner