Understanding session behavior
Author: joshmaCreated Jun 24, 2016Updated Oct 29, 2024
Labelsquestion
I'm trying to understand when running dumb-init under a session (i.e. not using --single-child) is useful, and I'm having a hard time reproducing the problem case. Here's a script I'm running that just runs yes as both background and foreground:
#!/bin/sh
yes > /dev/null &
yes > /dev/nullAnd then I'm running dumb-init -c -- /script.sh:
$ ps aux | grep sh
...
docker 13014 0.8 0.0 1100 4 pts/0 Ss+ 19:57 0:00 dumb-init -c -- /bin/sh script.sh
docker 13020 0.0 0.0 4448 776 pts/0 S+ 19:57 0:00 /bin/sh script.sh
docker 13033 0.0 0.0 9760 1028 pts/1 S+ 19:57 0:00 grep sh$ ps aux | grep yes
...
docker 13021 99.2 0.0 4352 640 pts/0 R+ 19:57 0:10 yes
docker 13022 101 0.0 4352 692 pts/0 R+ 19:57 0:11 yes
docker 13039 0.0 0.0 9620 888 pts/1 R+ 19:57 0:00 grep yesWhen I run kill 13014, the sh process quits, and all yes processes quit as well. It's immediate, so this isn't the "TERM then wait 10s before KILL" behavior. This looks like good behavior, even though I'm using the -c flag. Am I incorrectly reproducing this?
Source: Yelp/dumb-init