Timeline for How to get list of all child process spawned by a script
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 2, 2015 at 16:41 | answer | added | Vlad A. Ionescu | timeline score: 10 | |
Sep 10, 2013 at 5:55 | vote | accept | irraju | ||
Sep 10, 2013 at 5:55 | answer | added | irraju | timeline score: 1 | |
Sep 8, 2013 at 13:17 | comment | added | Tim |
This is more a type of workaround than a solution for your initial question: Open a new bash session. You can list all processes spawned from this shell using ps without any arguments (should be only bash and ps in the beginning). Start your script there. After it finished, wait until ps | wc -l reaches your expected value.
|
|
Sep 7, 2013 at 2:08 | comment | added | Scott - Слава Україні |
Do the scripts have to run under the UID of the author user? If not, can you create a dummy user just for this purpose? You wouldn’t even need grep , just ps –udummy_user . Also, look at process groups.
|
|
Sep 6, 2013 at 18:27 | comment | added | terdon |
I don;t think it is possible after the parent script has ended unless you can capture the parent's PID. If you are launching the scripts, you could wrap them in something like pid$(foo.sh; echo $!) which will give you the PID of foo.sh so you can then use ps --ppid . Will that work?
|
|
Sep 6, 2013 at 17:15 | history | asked | irraju | CC BY-SA 3.0 |