Python watching for process start up?
I know of no way for a process which does not have root privileges to be notified when a process is started via any means on a fully-running Linux system. If polling isn't fast enough, you're going to have to do some serious hackery.
If you've got root, this is possible. If not, I can't see it.
With root, you could set a system-wide replacement of the fork
and exec
system calls which provides you with your desired notification. This could be in the kernel, or it could be an LD_PRELOAD
hack.
This applies not just to Python; even with a C program, I don't know of an "inotify
for process creation".