ruby脚本/ delayed_job启动的问题。 Windows上的delayed_job和守护进程

时间:2010-06-16 15:53:40

标签: ruby-on-rails ruby delayed-job

收到此错误。

  pid-file for killed process 8600 found (C:/cyncabc/tmp/pids/delayed_job.pid), deleting.
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:103:in `fork': fork() function is unimplemented on this machine (NotImplementedError)
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:103:in `safefork'
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/daemonize.rb:145:in `call_as_daemon'
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:219:in `start_proc'
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:255:in `start'
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:69:in `run'
        from 
  c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:188:in `run_proc'
        from c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call'
        from c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions'
        from c:/ruby/lib/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:187:in `run_proc'
        from c:/ruby/lib/ruby/gems/1.8/gems/delayed_job-2.0.3/lib/delayed/command.rb:71:in `run_process'
        from c:/ruby/lib/ruby/gems/1.8/gems/delayed_job-2.0.3/lib/delayed/command.rb:65:in `daemonize'
        from c:/ruby/lib/ruby/gems/1.8/gems/delayed_job-2.0.3/lib/delayed/command.rb:63:in `times'
        from c:/ruby/lib/ruby/gems/1.8/gems/delayed_job-2.0.3/lib/delayed/command.rb:63:in `daemonize'
        from script/delayed_job:5

有没有解决这个问题的解决方案?它与ruby脚本/ delayed_job运行正常。

2 个答案:

答案 0 :(得分:5)

错误告诉您,延迟作业使用的守护程序gem在Windows上不起作用,因为Windows中没有fork API(fork是UNIX / Linux系统调用)。您需要切换到与Windows兼容的后台处理库,或者切换到Linux或Mac OS X以进行Rails开发。

答案 1 :(得分:1)

您可以在单独的提示中手动启动它,而不是rake jobs:work ruby script/delayed_job

由于您正在直接调用脚本,因此没有分支到那里的背景。

希望能帮助。