tdihp
tdihp

Reputation: 2399

tracking all child process spawned by a root process

I'm inspecting a certain make system that runs compilers. I want to track all child processes ever spawned by such a "root" process.

I'm aware there's the ps command and as I'm a Python user, the psutil package. But I'm not sure if I'll miss some short lived processes between the calls.

I think what I really want is something like inotify (or watchdog in Python), but instead of tracking directory, it tracks all child process activity.

Is there such a system call, or preferably, package of Python, that does this?

Thanks in advance.

Upvotes: 1

Views: 547

Answers (1)

kaylum
kaylum

Reputation: 14044

sttace can provide that info. But you may have to parse the output to get just the info you are interested in.

strace -f -e trace=process <executable>

That will trace all child processes of <executable> and will trace only the process related syscalls (essentially wait, fork, clone and exec).

Upvotes: 1

Related Questions