Timeline for Why does "su -c <command> &" seemingly allow a command to run in the background without hanging up
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 16, 2018 at 19:02 | comment | added | Toddius Zho | bash/tail doesn't protect against SIGHUP, yet that still works: ``` local$ ssh root@REMOTE_HOST remote# chroot --userspec root:root / sh -c "exec bash -c 'tail -f /dev/null'" & [1] 6376 remote# ps -p $! --no-heading -o pid,uid,command -ww 6376 0 tail -f /dev/null remote# exit local$ ssh root@REMOTE_HOST remote# ps -p 6376 --no-heading -o pid,uid,command -ww 6376 0 tail -f /dev/null ``` | |
| Feb 15, 2018 at 17:33 | comment | added | Gilles 'SO- stop being evil' | @ToddiusZho Presumable some_forever_process was intended to run forever (a daemon) and so protects itself against receiving SIGHUP from a terminal exit (by running in its own process group). | |
| Feb 15, 2018 at 0:48 | comment | added | Toddius Zho | I've seen root user do chroot --userspec root:root / sh -c "exec some_forever_process" &. Job is running as same user, with no explicit nohup before or disown later. So for this case, how is it the signal cannot be delivered on term exit? | |
| Dec 31, 2012 at 23:21 | history | answered | Gilles 'SO- stop being evil' | CC BY-SA 3.0 |