# Running ruby scripts from rails

**URL:** <https://www.ruby-forum.com/t/running-ruby-scripts-from-rails/178582>\
**Category:** Rails\
**Created:** [November 7, 2009, 1:34am UTC](https://www.ruby-forum.com/t/running-ruby-scripts-from-rails/178582 "2009-11-07T01:34:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbtbtb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/df788c/32.png) [@tbtbtb](https://www.ruby-forum.com/u/tbtbtb)\
**Post date:** [November 7, 2009, 1:34am UTC](https://www.ruby-forum.com/t/running-ruby-scripts-from-rails/178582/1 "2009-11-07T01:34:12Z")

</div>

Hi,  
First, I am new to rails.  
I have written a Ruby script to test some perf issues in socket calls.  
The Ruby code spins up some server threads listening on localhost, and  
then starts a client on the main thread, and measures the performance.  
(note, this is on Windows).

My primary goal is to get this perf data into a nice format, and  
secondary goal is to:

- execute the scripts from a rails application
- feeding it parameters
- _ **getting feedback while executing** _ (it takes minutes to  
complete)
- report the perf numbers back to a page

So, because the servers report info, and they are on separate threads,  
I thought I would use a DB to dump the data into (instead of dealing  
with synchronization and merging issues of passing data between  
threads).

My script currently prints info to STDOUT as it progresses. I am not  
sure the best way to approach feedback to the rails app here. As well,  
I would like to be able to cancel the script as well.

So, my questions are:

1. What are some ways I can run this ruby script and get real time  
feedback from it, updating a webpage with that info. I am not looking  
for “use ajax” but maybe some specific examples out there that do  
things like this.

2. And how would I go about canceling it.

Pointers to sites/examples with code would be great. Or even pointers  
to keywords to search for would be helpful.

Thanks for your help.
