Timeline for Stop/kill a process from the command line after a certain amount of time
Current License: CC BY-SA 4.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 24, 2018 at 18:35 | comment | added | Kusalananda♦ | You have $$ which would be the PID of the current script. Is that what you're thinking of? | |
| Nov 24, 2018 at 18:34 | comment | added | Z E Nir | I thought "$!" will return the PID of the invoking script... good to learn new things. Thanks! (btw i didn't try it with python, but my script is working with a while(1) C program) Also in your solution, you must consider 10 seconds is a lot of time and maybe $! value is no longer what you wanted... | |
| Nov 24, 2018 at 17:44 | comment | added | Kusalananda♦ | You don't start anything in the background. If you did (using &), the PID of that process would be available in "$!". | |
| Nov 24, 2018 at 17:40 | history | answered | Z E Nir | CC BY-SA 4.0 |