I trying to make an executable, which starts a Sinatra application via Thin as a daemon. I am using this code to invoke Thin with the Sinatra app:
#!/usr/bin/env ruby
require 'thin'
require 'app.rb'
server = ::Thin::Server.new('127.0.0.1', 9999, App)
server.log_file = 'tmp/thin.log'
server.pid_file = 'tmp/thin.pid'
server.daemonize
Here is the log output I get when I execute the script:
>> Writing PID to tmp/thin.pid
>> Exiting!
The server starts fine when I do
server.start
Any suggestions how I track down why it exits immediately?