Forum: Ruby on Rails System Commands in Web App

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ron M. (Guest)
on 2007-07-09 22:09
(Received via mailing list)
How would I go about calling system commands in a web app?
Does anyone have any source available that I can look at?

Thanks!
Jean N. (Guest)
on 2007-07-10 00:45
Ron Mr. wrote:
> How would I go about calling system commands in a web app?
> Does anyone have any source available that I can look at?
>
> Thanks!

Try just using the 'backticks' around your commands and trapping the
results.

Ex: result = `ps -aef`

But keep in mind you hold up your request while it's processing. If you
need something a bit more robust create a queue, have a thread process
the queue and put results into a a DB. The you can a monitoring page
(maybe using AJAX) To get the results/status for your processes.
This topic is locked and can not be replied to.