Reputation: 2622
I am looking to frequently create 3 background tasks and execute some shell commands from these tasks from my Rails app. I was thinking about using delayed_job for the background tasks but I am unsure as to how to safely execute shell commands from a rails app, can someone tell me how I can do this from a Rails app?
Jeff
Upvotes: 1
Views: 1307
Reputation: 7304
There are several ways, all are Rubyisms.
system('cmd','arg1',...)
Or the very Unixy
val = `ls -l`
The latter would run the command and return it's output into the variable val.
Upvotes: 4