How to know start and kill processes within Java code (or C or Python) on *nix
- by recipriversexclusion
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
Be able to kill any of the created processes 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 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.