nohup is a command used in UNIX/LINUX environments to ignore the Hang Up signal, i.e. exiting the console. The job will still be running even when the user logs out.
Recently, my colleague and I encountered a problem while running a job in the background. Although we used the nohup command, but while exiting the console, the job exited as well.
The command executed was as below:
$ nohup defghi > abc.txt &
While exiting the console for the first time, a message was prompted: “There are still running jobs”. Exiting for the second time, will exit the console and also kill the job.
A word around to this is to execute the nohup job as above, then followed by the below command:
$ nohup -p <pid>
This will prevent the job from terminating while exiting the console.
While googling, I found another solution but have yet to test it out.
$ defghi > abc.txt
$ [ctrl+z]
$ bg
$ disown