Server started as daemon: Application behaves differently from running in console

Hi,

running our app from its application folder /app via

script/server -p

works fine.

Starting the rails server (2.3.17) as a daemon via

cd /app && script/server -p -d

(e.g. as init.d script)

our application works in parts, but on several actions throws the error
below. It seems that the daemon does not have the correct environment
and cannot find the mentioned file.

How do I bring the daemon to run in the /app folder?

MissingSourceFile (no such file to load –
lib/apn_on_rails/app/helpers/connection_helper):
vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails/app/models/apn/app.rb:1
vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails/apn_on_rails.rb:62
vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails/apn_on_rails.rb:61:in
each' vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails/apn_on_rails.rb:61 vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails.rb:2 vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails.rb:1:ineach’
vendor/gems/apn_on_rails-0.4.2/lib/apn_on_rails.rb:1
app/models/push_setting.rb:1
app/models/device.rb:168:in deactivate' app/controllers/api/v2/devices_controller.rb:195:indestroy’
app/controllers/api/application_controller.rb:44:in safe_run' app/controllers/application_controller.rb:10:inlog_request’
/usr/local/lib/ruby/gems/1.8/gems/newrelic_rpm-3.5.0.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:270:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/newrelic_rpm-3.5.0.1/lib/new_relic/agent/method_tracer.rb:242:intrace_execution_scoped’
/usr/local/lib/ruby/gems/1.8/gems/newrelic_rpm-3.5.0.1/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/newrelic_rpm-3.5.0.1/lib/new_relic/rack/browser_monitoring.rb:12:incall’
/usr/local/lib/ruby/gems/1.8/gems/newrelic_rpm-3.5.0.1/lib/new_relic/rack/developer_mode.rb:24:in
call' lib/api_profiler.rb:27:in_call’
lib/api_profiler.rb:23:in call' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:ineach’
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start’

Rendered rescues/_trace (32.0ms)
Rendered rescues/_request_and_response (1.0ms)
Rendering rescues/layout (internal_server_error)

I had a similar problem. I changed path of the desired file to start
with RAILS_ROOT (Rails.root on 3.x I think). and that fixed it.

Norm