I'm looking for an easy method to run N
selected processes at the same time with one command. It should put all the output on my terminal and shut down all of them when I exit with ctrl+c
. Is there any existing app that does this?
I'm thinking of some thing like exec_many 10 foo
- it should keep 10 foo
s running and respawn any that dies.
I don't know of one off hand, but you could do this with Bash without too much work. I would put each of the foo processes in a process group. You can then trap SIGINT in the parent and kill the process group with
kill -pgid
(Negative before process group number). You can also launch them all as jobs. So they all run at once (Pretty much). Finally, you could loop over the ouput of jobs every x seconds (sleep in the loop) and get the count, if the count is less than the number of foo processes, than you can fire up another one (Could get more fancy by making sure none are stopped etc).A rough Version might be something like:
You can also find similar sort of stuff in the "Proccesses and Concurrency" section of Pythton for Unix and Linux System Adminsitration.
From synaptic....