Timeline for How to stop "tail -f" in a script and exit if a certain condition is fulfilled?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 31, 2023 at 16:39 | history | became hot network question | |||
| May 31, 2023 at 11:26 | comment | added | Neinstein | @aviro Ah, that's actually pretty cool. | |
| May 31, 2023 at 11:19 | comment | added | aviro |
By the way - you don't need the loop waiting for $outf to appear - you can use tail's -F flag (equivalent to --retry -f) instead of -f, which will keep trying to open the file until it appears.
|
|
| May 31, 2023 at 10:19 | comment | added | Neinstein | I'm not sure if such things as "cross-site duplicates" exist, but turns out the core problem is exactly this: How to get the PID of a process that is piped to another process in Bash? | |
| May 31, 2023 at 10:14 | answer | added | Neinstein | timeline score: 3 | |
| May 31, 2023 at 10:09 | comment | added | Neinstein | @Paul_Pedant Correct! Knowing this, I found the answer: stackoverflow.com/a/8048493/5099168. Thanks for the tip! | |
| May 31, 2023 at 9:50 | comment | added | Paul_Pedant |
I suspect tail | tee in Bash runs a subshell, and does not return the Pid of either the tail or the tee. SigInt (kill -2) will be ignored by that subshell.
|
|
| May 31, 2023 at 8:45 | history | edited | Neinstein | CC BY-SA 4.0 |
edited body
|
| May 31, 2023 at 8:35 | history | asked | Neinstein | CC BY-SA 4.0 |