Q:

How can I run a ruby script right after the server starts in Rails 5

I have two ruby scripts that need to be running while the server is.
Currently I am running them separately using detached screens, but I would like to launch them at the same time the rails server is starting.
How can I integrate them so that I can achieve this behavior?

A:

Have you tried Foreman gem? It will allow you to create a simple file (Procfile) where you can specify all the process that should be started simultaneously. 
I usually create a file named Procfile.dev in the project's root, that would look like for example:
web: bundle exec rails server thin start -p 4000
mail: mailcatcher -f
your_script: instructions

Then you start your Rails app as:
foreman start -f Procfile.dev

With that command, Foreman will execute all the processes on the file. 
You should install the gem locally and not in the Gemfile.
Foreman Gem

