When i write a shell script like below:
# demo.sh somework &
Then run it
sh demo.sh.Use & will cause the demo.sh exit and make the somework's parrent PID be 1, the init.
Then i exit my terminal, make the session over, why the somework doesn't receive the HUP, and jobs can't show it. So i guess it has been disown.
I write some code in ruby to test it:
# Fork an process then sleep it. fork do sleep end
Then i run it with
ruby demo.rb. With
ps shown it parent process is init now.
Then i exit my terminal. It still running.
Why when a process become an orphan will disown it ?