Asking this after a prolonged discussion with a coworker, I'd really like a clarification here.
I launch a background process, either by appending "
&" to the command line or by stopping it with
CTRL-Z and resuming it in background with "
bg". Then I log out.
We were quite sure it should have been killed by a SIGHUP, but this didn't happen; upon logging in again, the process was happily running and
pstree showed it was "adopted" by
Is this the expected behaviour?
But then, if it is, what's the
nohup command's purpose? It just looks like the process isn't going to be killed anyway, with or without it...
Some more details:
- The command was launched from a SSH session, not from the physical console.
- The command was launched without
&; it was then suspended with
CTRL-Zand resumed in background with
- The ssh session did not drop. There was an actual logout ("
- The process was a
scpfile copy operation.
- Upon logging in again,
pstreeshowed the process running and being child of
To state the question more clearly: will putting a process in background (using
bg) make it ignore
SIGHUP, just like the
nohup command does?
I tried manually sending a
scp: it exited, so it definitely doesn't ignore the signal.
Then I tried again launching it, putting it in the background and logging off: it got "adopted" by
init and kept running, and I found it there when logging back on.
I'm quite puzzled now. Looks like no
SIGHUP was sent at all upong logging off.