Operating System - HP-UX
1753783 Members
7160 Online
108799 Solutions
New Discussion юеВ

who is the parent process of nohup started processes

 
SOLVED
Go to solution
Shivkumar
Super Advisor

who is the parent process of nohup started processes

Hi,

If a process or program started by nohup command followed by & symbol and i come out of the terminal by exit command; then, is the process gets adopted by "init" process as the parent and would continue running ?

Thanks,
Shiv
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: who is the parent process of nohup started processes

Yes, in the case where you logoff and you have a nohup'ed command running, the parent PID becomes 1 (init) and the process continues to run.

This is really the sort of question that you should ask the box itself because some of us might lie to you but the box never does.

Do something like this:

nohup sleep 300 & # just sleep for 5 minutes
ps -u shiv -f
and note the output, paying attention to the PPID and PID columns.
Next,
exit # logout
and immediately log back in as user "shiv".
ps -u shiv -f
and note that the PPID is now 1 but the sleep is still running.

You really need to learn how to ask the box directly because that is the way you learn.

If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: who is the parent process of nohup started processes

nohup is a process protector, to isolate the process from the Unix signal HUP or hangup. When a parent exits, all child processes still running will be sent the HUP signal. When nohup sees the parent go away, it will transfer the protected process to init. So the process will first have a parent of nohup then init when nohup's parent terminates. nohup's parent is whatever process started it, typically a shell.


Bill Hassell, sysadmin