3

所以我在生产应用程序上安装了延迟作业。它通过 rake jobs:work 运行良好。但是当我尝试通过 capistrano 启动脚本时:

run "if [ -d #{current_path} ]; then cd #{current_path} && RAILS_ENV=#{rails_env} script/delayed_job start -n 2; fi"

它开始时没有错误。但是如果我检查script/delayed_job status它告诉我没有实例正在运行。有什么建议么?

编辑

看起来有东西在运行(通过sudo ps aux | grep delayed):

 1000      7952  0.0  0.1 112312   832 pts/0    S+   16:17   0:00 grep delayed

运行脚本时的输出:

/path/to/latest/release/config/initializers/bypass_ssl_verification_for_open_uri.rb:2: warning: already initialized constant VERIFY_PEER
4

2 回答 2

4

检查您的 shared/tmp/pid 文件夹的权限。

除非运行 capistrano 的用户有权将 PID 文件写入文件夹,否则延迟作业将不会运行。

于 2013-01-30T19:22:16.690 回答
0

这就是我使用 capistrano 启动延迟工作恶魔的方式,也许这也对你有用:

require "delayed/recipes"

%w[start stop restart].each do |command|
  after "deploy:#{command}", "delayed_job:#{command}"
end

的输出ps aux | grep delayed只显示了它自己的进程,所以 DJ 没有在你的机器上运行。也许这与您的 -if子句有关。您可以尝试删除它,看看它是否使用ps aux | grep命令正确启动。输出应该是这样的:

username    9989  0.0  0.0   7640   892 pts/0    S+   10:54   0:00 grep delayed
username   10048  0.0  9.4 288244 99156 ?        Sl   Jan22   2:16 delayed_job
于 2013-01-26T09:55:32.227 回答