2010-09-27 16 views
5

Tôi đang sử dụng BluePill để quản lý các quy trình như công việc bị trì hoãn cho Rails. Trong nhật ký BluePill, tôi nhận được tin nhắn này:Thiếu tệp PID khi sử dụng trình quản lý quy trình để bắt đầu công việc bị trễ

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 

Vì vậy, nó tuyên bố rằng một tập tin pid là mất tích, mà nó được, nhưng không nên rằng PID được tạo ra khi BluePill bắt đầu quá trình công việc hoãn?

Cập nhật Để rõ ràng hơn về lỗi này, tôi có thể chạy thành công lệnh thủ công nhưng Bluepill không chạy lệnh bắt đầu. Khi tôi chạy nó bằng tay, nó trông như thế này:

[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. 

Khi tôi chạy nó với Bluepill nó trông như thế này:

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 

viên thuốc của tôi trông như thế này:

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 

Và tập lệnh lệnh trì hoãn của tôi trông giống như sau:

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

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

2 câu hỏi nhìn thấy như thế nào điều này vẫn chưa được trả lời. Bạn sẽ cần phải có giấy phép gì để ghi vào thư mục/srv/fsg_distro/shared/pids/và đường dẫn người dùng (từ máy george?) Có các quyền đó không? – Hugo

+0

Bluepill và tôi đăng nhập là cùng một người dùng .... Miễn là người dùng là chủ sở hữu hoặc trong nhóm, anh ấy có thể ghi vào thư mục pids – Tony

Trả lời

1

Tôi không có câu trả lời, nhưng chính xác là cùng một câu hỏi. Tôi đã thử nhiều, nhiều giải pháp - bao gồm việc tạo tập lệnh khởi động cho init.d và gọi nó từ bluepill như được mô tả trong một bài đăng dựa trên đơn vị khác (http://stackoverflow.com/questions/1226302/how-to-monitor -delayed-job-with-monit), nhưng không có gì có hiệu quả. Luôn có vấn đề về quyền với tệp PID. Làm thế nào điều này có thể là trường hợp khi chạy như su?

Tôi sở hữu mã và chia sẻ mã đó với nhóm www. Tôi có cần tạo người dùng tùy chỉnh chỉ để chạy thẻ xanh không? Nếu vậy, với cài đặt nào?

2

Nếu bạn daemonize delayed_job (mà bạn đang có) sau đó bạn phải tạo ra một tập tin pid cho nó chính mình, hoặc nhận delayed_job để làm điều đó cho bạn, sau đó bluepill hy vọng sẽ tìm tập tin pid lần grace_start_time đã trôi qua.

Nếu bạn chạy delay_job ở nền trước, và bạn nói với bluepill để daemonize quá trình cho bạn, sau đó bluepill sẽ tạo tệp pid.

Bạn không thể vừa giám sát quá trình tự thực hiện và tạo ra tệp pid. Nó là cái này hay cái kia.

Các vấn đề liên quan