Timeline for Parent restarted by child doesn't respond to CTRL-C
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 9, 2015 at 21:00 | history | tweeted | twitter.com/#!/StackUnix/status/564891731658031104 | ||
| Feb 8, 2015 at 23:20 | answer | added | Ethan | timeline score: 0 | |
| Feb 8, 2015 at 22:46 | comment | added | Ethan | thats clever. Im trying to avoid the end user (who types restarter -A) from having to run anything else, otherwise I'd just have them start the supervisor first. But I think I figured out the solution: an extra call to exec at the beginning, and let the first process hang forever to catch the signals | |
| Feb 8, 2015 at 22:40 | comment | added | Stéphane Chazelas | or using another fd to avoid affecting stdout: { restarted -A 3>&1 >&4 4>&- | cat > /dev/null 4>&-; } 4>&1 | |
| Feb 8, 2015 at 22:39 | comment | added | Stéphane Chazelas | you could pipe your process to cat (restarter -A | cat). cat would not die until the pipe is closed (that is when all the processes have died (unless they close their stdout)). | |
| Feb 8, 2015 at 22:33 | comment | added | Ethan | is it possible to avoid giving up the foreground pg, even with a dead parent? | |
| Feb 8, 2015 at 22:30 | comment | added | Stéphane Chazelas | Note that exec doesn't spawn a process. The shell is waiting for the first process, once that dies, the shell sets the foreground process group back to the shell's. You'd need your first process not to die or be suspended. Probably better rethink the whole thing. If D is a monitoring process, it should be the parent. | |
| Feb 8, 2015 at 21:31 | comment | added | Ethan | I added a period to clarify. It's all one program. You can launch it from the terminal with restarter -A. It spawns a child process using exec (ie. it calls restarter -D). Now we have two processes, A and D. Process D now sends SIGINT to A, causing A to die. Now D runs exec restarter -A, effectively restarting process A. Now the terminal user can no longer kill the processes with CTRL-C | |
| Feb 8, 2015 at 21:29 | history | edited | Ethan | CC BY-SA 3.0 | clairfy program vs process. |
| Feb 8, 2015 at 21:24 | comment | added | Stéphane Chazelas | The question is unclear to me. You're mixing program and process in a confusing way. Is it D that shutdowns? What do you mean by that? | |
| Feb 8, 2015 at 21:20 | review | First posts | |||
| Feb 8, 2015 at 21:23 | |||||
| Feb 8, 2015 at 21:16 | history | asked | Ethan | CC BY-SA 3.0 |