2010-09-27 36 views
5

我正在使用BluePill來管理進程,例如Rails的延遲作業。在BluePill日誌,我得到這個消息:使用進程管理器啓動延遲作業時丟失PID文件

W, [2010-09-27T01:23:20.447053 #19441] WARN -- : [fsg_distro:delayed_job] pid_file /srv/fsg_distro/shared/pids/delayed_job.pid does not exist or cannot be read 
W, [2010-09-27T01:23:20.447368 #19441] WARN -- : [fsg_distro:delayed_job] Executing start command: ruby script/delayed_job -e production start 
I, [2010-09-27T01:23:20.469165 #19441] INFO -- : [fsg_distro:delayed_job] Going from down => starting 

因此它聲稱一個pid文件丟失,這是,但不應是PID被創建時BluePill啓動延時工作過程?

更新 要更清楚地瞭解此錯誤,我可以手動成功運行該命令,但Bluepill無法運行啓動命令。當我手動運行它,它看起來像這樣:

[email protected]:/srv/fsg_distro/current$ /usr/bin/env RAILS_ENV=production /usr/bin/ruby /srv/fsg_distro/current/script/delayed_job start 
delayed_job: process with pid 17564 started. 

當我與Bluepill運行它,它看起來是這樣的:

W, [2010-10-03T21:24:13.943136 #17326] WARN -- : [fsg_distro:delayed_job] pid_file /srv/fsg_distro/shared/pids/delayed_job.pid does not exist or cannot be read 
W, [2010-10-03T21:24:13.943391 #17326] WARN -- : [fsg_distro:delayed_job] pid_file /srv/fsg_distro/shared/pids/delayed_job.pid does not exist or cannot be read 
I, [2010-10-03T21:24:13.943811 #17326] INFO -- : [fsg_distro:delayed_job] Going from starting => down 
W, [2010-10-03T21:24:14.945274 #17326] WARN -- : [fsg_distro:delayed_job] pid_file /srv/fsg_distro/shared/pids/delayed_job.pid does not exist or cannot be read 
W, [2010-10-03T21:24:14.945495 #17326] WARN -- : [fsg_distro:delayed_job] pid_file /srv/fsg_distro/shared/pids/delayed_job.pid does not exist or cannot be read 
W, [2010-10-03T21:24:14.945826 #17326] WARN -- : [fsg_distro:delayed_job] Executing start command: /usr/bin/env RAILS_ENV=production /usr/bin/ruby /srv/fsg_distro/current/script/delayed_job start 
W, [2010-10-03T21:24:15.049261 #17326] WARN -- : [fsg_distro:delayed_job] Start command execution returned non-zero exit code: 
W, [2010-10-03T21:24:15.049491 #17326] WARN -- : [fsg_distro:delayed_job] {:stderr=>"", :exit_code=>1, :stdout=>""} 
I, [2010-10-03T21:24:15.049947 #17326] INFO -- : [fsg_distro:delayed_job] Going from down => starting 

我的藥丸是這樣的:

APP_ROOT='/srv/fsg_distro' 
RAILS_ROOT='/srv/fsg_distro/current' 
RAILS_ENV='production' 
RUBY_EXEC='/usr/bin/ruby' 

Bluepill.application("fsg_distro", :log_file => "/srv/fsg_distro/shared/log/bluepill.log") do |app| 
    app.process("delayed_job") do |process| 
    process.working_dir = RAILS_ROOT 

    process.start_grace_time = 30.seconds 
    process.stop_grace_time  = 30.seconds 
    process.restart_grace_time = 30.seconds 

    process.start_command = "/usr/bin/env RAILS_ENV=#{RAILS_ENV} #{RUBY_EXEC} #{RAILS_ROOT}/script/delayed_job start" 
    process.stop_command = "/usr/bin/env RAILS_ENV=#{RAILS_ENV} #{RUBY_EXEC} #{RAILS_ROOT}/script/delayed_job stop" 

    process.pid_file = "#{APP_ROOT}/shared/pids/delayed_job.pid" 
    process.uid = "deploy" 
    process.gid = "deploy" 
    end 
end 

而且我的延遲作業腳本如下所示:

#!/usr/bin/env ruby 
ENV['RAILS_ENV'] ||= 'production' 

require File.dirname(__FILE__) + '/../config/environment' 
require 'delayed/command' 
Delayed::Command.new(ARGV).daemonize 
+1

2個問題看到如何仍未得到答覆。你需要什麼權限才能寫入文件夾/ srv/fsg_distro/shared/pids /,並且用戶導軌(來自機器george?)是否擁有這些權限? – Hugo 2010-10-06 14:17:10

+0

Bluepill和我登錄的用戶是同一個用戶....只要用戶是所有者或組中的用戶,他就可以寫入pids目錄 – Tony 2010-10-08 01:01:21

回答

1

我沒有答案,但完全一樣的問題。 我已經嘗試了很多很多的解決方案 - 包括爲init.d創建啓動腳本並從另一個基於monit的發佈中描述的bluepill中調用該腳本(http://stackoverflow.com/questions/1226302/how-to-monitor -delayed-job-monit),但沒有任何工作。始終存在PID文件的權限問題。當su運行時,情況怎麼會如此?

我擁有該代碼,並與組www共享。 我是否需要創建一個自定義用戶才能運行bluepill?如果是這樣,用什麼設置?

2

如果守護進程的delayed_job(你是),那麼你必須產生一個pid文件爲它自己,或得到的delayed_job來爲你做它,然後bluepill希望找到pid文件一旦grace_start_time已經過去了。

如果您在前臺運行delayed_job,並且您告訴bluepill爲您守護進程,那麼bluepill將生成pid文件。

您不能同時監控自我守護進程並且使用藍圖創建pid文件。它是一個或另一個。