Timeline for I am using `&`: why isn't the process running in the background?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 30, 2022 at 8:50 | comment | added | Shadur-don't-feed-the-AI | Note that logging out without nohuping or disowning the backgrounded process will cause the SSH process to stay active until the backgrounded process terminates or until you interrupt it, and if you do the latter the backgrounded process still gets the SIGHUP and goes byebye. | |
| Apr 29, 2021 at 13:13 | history | edited | phemmer | CC BY-SA 4.0 | added 34 characters in body |
| Aug 26, 2016 at 5:13 | comment | added | Hitechcomputergeek | Instead of nohup python program.py & I'd recommend using setsid python program.py instead, which immediately disowns the program. | |
| Jun 7, 2014 at 22:18 | vote | accept | bernie2436 | ||
| Jun 7, 2014 at 14:42 | comment | added | Ruslan | Also note that nohup generates a nohup.out file with output of the program you start with it. May be annoying to delete that file every time you've used nohup to start an app this way (or you'd need to redirect its output to /dev/null). | |
| Jun 6, 2014 at 22:24 | comment | added | phemmer | Never mind, answered my own question. POSIX IEEE 1003.1 chap 11, If a modem disconnect is detected by the terminal interface for a controlling terminal ... the SIGHUP signal shall be sent to the controlling process. | |
| Jun 6, 2014 at 22:14 | comment | added | phemmer | @StéphaneChazelas That's one thing I've never dug into. If it's the kernel doing it, how does it determine which process to SIGHUP? It obviously doesn't SIGHUP everything with an open file descriptor to that TTY, as programs will remain running as long as they don't try to use it. So does it pick the program that is currently reading from STDIN (since only one can read from STDIN at a time)? | |
| Jun 6, 2014 at 22:04 | comment | added | Stéphane Chazelas | Technically, ssh dying causes the connection to drop, the connection to drop causes sshd on the other end to die. That sshd controlling the master side of the pseudo-terminal that the remote shell runs, when it dies, that's a hang-up (it's like pulling the plug on a real terminal), so the system sends a SIGHUP to the remote shell. | |
| Jun 6, 2014 at 21:58 | history | answered | phemmer | CC BY-SA 3.0 |