Paul Verschoor
Paul Verschoor

Reputation: 1559

How do I run a Sinatra app as a deamon from the command line?

How do I run a Sinatra app as a deamon from the command line?

It is using Thin:

ruby app.rb -p 3000 -e production

I don't like to set it up in the app.rb itself. I want to deamonise it from the command line.

Upvotes: 6

Views: 2568

Answers (2)

Paul Verschoor
Paul Verschoor

Reputation: 1559

From Start Sinatra app in the background with stdout and stderr redirected (append) to a file:

nohup ruby app.rb -p 3000 -e production >> log/log_file 2>&1 &

Upvotes: 3

Sir l33tname
Sir l33tname

Reputation: 4330

I don't know if it's possible with Ruby. But it's an easy task with rackup.

Just add a config.ru:

require './app'
run Sinatra::Application

And with this in place you can start it as a daemon:

rackup -p 3000 -E production -D

Upvotes: 2

Related Questions