title: How to show ping output dynamically in a web page?
body: <p>As part of a diagnostics page I would like to have the user be able to run a "ping", ie an ordinary shell command to send ICMP_ECHO_REQUSTs to a certain IP and display the resuls dynamically in a div in the browser.</p>
  
  <p>The backend is Ruby/Rails.</p>
  
  <p>I'm past running the command on the server side and reading the output from the ping command.</p>
  
  <p>And I've been building web pages that periodically calls back to the server to update som parts of the page dynamically.</p>
  
  <p>But in this case there are three challenges:</p>
  
  <ul>
  <li>be able to have the ajax call back to an uri/url to find the process that runs the ping command</li>
  <li>ideally be able to update the page when the ping command returns a new line of data</li>
  <li>Optionally be able to "break" the ping. With ping I can of course just set the option to only send x pings and then exit and thus eliminating the need to stop the process. But I also have another tool that would be next, a log viewer, and that tool does not stop by itself after a certain number of lines but continue forever if not interrupted, ie with Control-C.</li>
  </ul>
  
  <p>Do I set up a memcache to rendez-vous with the process running ping or is there a simpler way?</p>
  
  <p>I searched a lot thinking this should be a problem common enough to have a rails plugin just magically implementing whats needed but I didn't find much at all.</p>
  
  <p>Any suggestions or pointers?</p>