If you must start it during Rails initialization:
- Create a ruby file that will start the daemon. Say
invoke_daemon.rb
- Put this file in
config/initializers/invoke_daemon.rb
However if it isn't mandatory, I would suggest creating a binary executable or a rake
task and manually starting it through command line. This way it runs as a separate process. You can simply add it to your deployment scripts for production boxes and on development box run it manually. A few examples would be searchd
, the search daemon for sphinx
and thinking_sphinx:delayed_delta
rake task from thinking_sphinx
.