1

How can I launch several different ruby scripts in order from a bash script?

I've managed to achieve it on my Windows machine with a batch file but I'm struggling to figure out how to do it with bash.

Here's the contents of my batch file for reference:

start "1" cmd /k ruby replicaServer.rb
start "2" cmd /k ruby FileServer.rb
start "3" cmd /k ruby fileServer2.rb
start "4" cmd /k ruby directoryServer.rb
start "5" cmd /k ruby LockServer.rb
start "6" cmd /k ruby ClientProxy.rb
start "7" cmd /k ruby client.rb

1 Answer 1

3

How about

/usr/local/bin/ruby replicaServer.rb &
/usr/local/bin/ruby FileServer.rb &
/usr/local/bin/ruby fileServer2.rb &
/usr/local/bin/ruby directoryServer.rb &
/usr/local/bin/ruby LockServer.rb &
/usr/local/bin/ruby ClientProxy.rb &
/usr/local/bin/ruby client.rb &

Adjust the path to wherever you actually keep the ruby executable, lose the ampersands if you want things to run sequentially rather than in parallel.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, this worked. Is there a way for each script to be opened in individual terminal windows rather than all in one window? I should have mentioned that in my original question, apologies.
@ConorB To the best of my knowledge, that would depend entirely on what OS and what windowing system you're using. Launch your favorite terminal app as shown above, passing each copy a single one of the ruby invocations as an execution argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.