Because while a logout doesn't send a HUP unless huponexit is
set, it
DOES send a TERM signal which should terminate child processes. You
No. It seems if I didn't set huponexit, logout won't send either "HUP"
or
"TERM" to the background process. The process will keep running, like a
daemon after the logout. But if I set the huponexit, logout will kill the
background process with some other signals, they are not HUP or
TERM.
If I sent HUP to the session leader of the control terminal (the bash
I think, and
it didn't set huponexit), the bash will quit. Before that, the bash
will first send
HUP to the background process and then send another signal other than
TERM to kill it.
I think the "HUP" means the terminal maybe broken, so bash will signal
each of its child to
quit. But only logout it won't signal children.
need to trap that signal as well or use a "disown" on the
PID of the
child process to disassociate it from the login shell.
Thank you for pointing out the "disown".