I need to write a process controller module on Linux that handles tasks, which are each made up of multiple executables. The input to the controller is an XML file that contains the path to each executable and list of command line parameters to be passed to each. I need to implement the following functionality:
- Start each executable as an independent process
- Be able to kill any of the child processes created, independent of the others
In order to do (2), I think I need to capture the pid
when I create a process, to issue a system kill
command. I tried to get access to pid
in Java using ProcessBuilder
but saw no easy way to do it.
All my other logic (putting info about the tasks in DB, etc) is done in Java so I'd like to stick with that, but if there are solutions you can suggest in C, C++, or Python I'd appreciate those, too.