How does nohup work? [closed]

2019-04-29 00:51发布

问题:

What is performed behind the scenes when a program runs with nohup?

Is the PID of the parent process being changed?

Thanks.

EDIT: I understood that nohup (and disown) causes that SIGHUP is not sent to the process if the parent process receives it. Does it mean that it is equivalent to handling SIGHUP (and actually ignore it)?

回答1:

Use the source, Luke!

(Extra characters added to keep the new answer length rules happy.)



回答2:

It is equivalent to setting the SIGHUP handler to SIG_IGN, ie.

signal(SIGHUP, SIG_IGN);


回答3:

The Wikipedia article about nohup explains it pretty well.