Wednesday, November 18, 2009

How to Nohup an already running unix process

Starting a job at a Unix Command prompt will cause that job to be attached to the shell that started the job. If that shell is terminated, the job(s) that were started under it will be terminated as well. This is caused by the fact that when a UNIX process ends all the processes contained within that processes' process tree are also terminated.

If you have ever had the need to nohup a unix job that was already running, then I have the website for you. This website shows how to disown, nohup, suspend and resume jobs in UNIX.

Nohup stands for no hang-up. When a process is started in the nohup mode, then when the parent shell or process dies, the child process will not die. Disown is a built in bash command that allows you to nohup jobs that are already running.

Keep in mind that jobs and processes are to different things. Jobs are tasks or processes that are tied to a shell. Whereas processes are operating system notions. The above mentioned website gives a very clear description of job control in UNIX.

If you are impatient, and just want a command that will most likely do what you want:
prompt% disown -ar

If you are pretty comfortable with UNIX and UNIX job control, then
prompt% man bash
and search for disown

If you need a bit of help understanding jobs, processes, and job control then


No comments:

Post a Comment