in reply to catching a pid
You don't want to use system for something like this. Instead, you need to use fork followed by exec. The system function doesn't run in an asynchronous mode, for one thing. You would have to append a "&" to the command line to get it to background. Additionally, you couldn't just wait for a child process to exit, because the immediate child of you process is a shell, probably /bin/sh, used to execute the requested command.
There are numerous nodes out there that cover this topic, so I'll leave the finding of more specific code examples as an exercise. Start with the link above, to understand fork better, and go forward from there.
--rjray
|
|---|