Ruby

Running Ruby script on background

Run a Ruby script on the server background as a daemon

gem

gem install daemons

Ruby file

Ruby file that refers file app

#!/usr/local/rvm/rubies/ruby-2.3.1/bin/ruby

require 'rubygems'
require 'daemons'

Daemons.run('/apps/myapp.rb')

shell

Start or stop daemon

./mydaemon.rb start
./mydaemon.rb stop
./mydaemon.rb restart