views:

26

answers:

1

I am trying to run daemon process using daemon-spawn gem. Here is the code for delayed_delta daemon process


#file - script/dj
#!/usr/bin/env ruby
# -*- ruby -*-
require 'rubygems'
require 'daemon-spawn'

RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))

class DelayedJobWorker  ENV['MIN_PRIORITY'],
      :max_priority => ENV['MAX_PRIORITY']
    ).start
  end

  def stop
    system("kill `cat #{RAILS_ROOT}/tmp/delayed_job.pid`")
  end
end

DelayedJobWorker.spawn!(:log_file => File.join(RAILS_ROOT, "log", "delayed_job.log"),
                        :pid_file => File.join(RAILS_ROOT, 'tmp', 'delayed_job.pid'),
                        :sync_log => true,
                        :working_dir => RAILS_ROOT)

This works well in my local machine when I run

ruby script/dj start
, but when I run it in cloud server, it throws a weird error


/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- daemon-spawn (LoadError)
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from script/dj:4

any idea? any help?

A: 

Looks like the cloud server doesn't have the daemon-spawn gem. Are you using bundler on Heroku or something else?

Chuck Vose
Ok, here's the thing! I had "alexvollmer-daemon-spawn" in my local and I had "daemon-spawn" in my cloud!! Silly me....
Madhusudhan