How do you run multiple ruby files in conjunction in a shell script? How do you run multiple ruby files in conjunction in a shell script? shell shell

How do you run multiple ruby files in conjunction in a shell script?


Have you tried using & and wait?

ruby one.rb &ruby two.rb &ruby three.rb &ruby four.rb &waitruby five.rb &ruby six.rb &ruby seven.rb &ruby eight.rb &

http://tldp.org/LDP/abs/html/subshells.html


Create a text file which looks like:

 one.rb two.rb three.rb

...and so on. Call it "jobs" or whatever you want. Then, assuming you are running Ubuntu or a similar system:

 sudo apt-get install parallel parallel ruby < jobs

Information on the parallel command is available here: http://www.gnu.org/software/parallel/


Do not avoid Rake. Learn it now and benefit ever after.

require 'rake'run = -> sym { system "ruby #{sym}.rb" }u, v = [:one, :two, :three, :four ], [:five, :six, :seven, :eight]u.each { |sym| task sym do run.( sym ) end }multitask midpoint: uv.each { |sym| task sym => :midpoint do run.( sym ) end }multitask( all: v ).invoke