守护进程生成:gem_original_require:没有要加载的文件--daemon-spawn(加载错误)
我正在尝试使用 daemon-spawn gem 运行守护进程。 这是delayed_delta守护进程的代码,
#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)
当我运行时,它在我的本地机器上运行良好
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
有什么想法吗?有什么帮助吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题,最初我有
alexvollmer-daemon-spawn
但我无法运行更多数量的进程,所以我卸载了它并安装了daemon-spawn
gem这对我有用。注意:当您使用
alexvollmer-daemon-spawn
gem 时,请使用require daemon-spawn
,但当您使用daemon-spawn
gem 时,请使用 requiredaemon_spawn
(使用下划线)。I had the same problem, initially i had
alexvollmer-daemon-spawn
but i was unable to run more number of processes, So i uninstalled it and i installeddaemon-spawn
gem which worked for me.Note: When you use
alexvollmer-daemon-spawn
gem userequire daemon-spawn
, but when you usedaemon-spawn
gem use requiredaemon_spawn
(use underscore).有同样的问题。尝试
使用下划线。
Had the same problem. Try
I.e. use an underscore.
看起来云服务器没有 daemon-spawn gem。您在 Heroku 上使用捆绑器还是其他东西?
Looks like the cloud server doesn't have the daemon-spawn gem. Are you using bundler on Heroku or something else?