dimanche 8 mars 2015

How to launch and monitor multiple programs that must be run together

I have a research project that requires three programs to work together, each written in a different language: a C++ program called "A", a Scala program called "B", and a Node.js web server called "server."


The application operates as follows:


A user opens a web browser and connects to the web server, which serves up the web pages. When a user clicks on the interface, a "question" is triggered. The server sends the question to program A, and it also sends the question to program B. Note that programs A and B have no direct interaction with one another.


Both program A and B perform some calculations and return their results to the server, and the results are then forwarded to the web client and displayed in the browser window.


Given that this application essentially consists of three programs written in three different languages, I would like to know how best to run them essentially like a single application on a Linux machine.


I think that the ideal solution would be to have a program or script with the following abilities:


1) Ability to launch all three programs (the C++ binary, the Scala binary, and Node.js) with the correct arguments, specified at the command line.


2) Ability to monitor all three programs; i.e., if a program fails to launch or returns an error, try to launch it again; or, alternatively, if any of the three programs terminates, ensure that all three programs are thus terminated.


I would like to know what might be a best approach for accomplishing what I have described.


Thanks!


Aucun commentaire:

Enregistrer un commentaire