How to disconnect a running bash job from the shell in Linux?
- by raven
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 symbol
disown -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?