I have a web app which needs to be able to interact with an already running external process.
I need to have the ability to capture STDOUT and redirect it to the browser (e.g. for monitoring by a user). I also would like to have the ability to stop/restart the process.
I was considering using God to monitor the process but don't see any methods to read the output from the rails app.
Ruby 1.9.2 + Rails3.1
Thanks
I would start the process and capture it's output to some file
pid = Process.spawn("cat /dev/random > process.log")
Then you can read this file and display it any way you like
IO.read('process.log')
And if you want to kill the process just use
Process.kill(9, pid)
As you can see you will need to store pid somewhere.
I'm not sure how to be with the external process. You will probably want to store the pid in the same place when you are spawning the process outside.