I would like to understand the behavior of a process running with disown when a SIGHUP (or similar) from a shell logout occurs.
The process simply does the following:
- sleep 15 seconds
- print "hello";
- creates an empty file in /tmp
Ok, we run the process and then do a ctrl-z, bg, disown and logout.
After 15 seconds the empty file in /tmp does not exist. If I remove the second command (print), the process ends and the empty file exists, So if the process sends something to stdout without a shell attached, then receives some signal from the kernel that kills it.
The process must be in Perl, PHP or C (With Bash or Python seems that does not occur)
I know that a background execution with nohup sends the output to a file and we will not have this issue, but the question is to understand the behavior of disown command when we have executed the process with some output. (btw, disown with -h has the same result).