2010-10-01 106 views
0

似乎無法獲得延遲工作獲得與monit的運行。這裏是我的delayed_job.monitrc文件..延遲工作,monit的

check process delayed_job with pidfile /var/www/app/shared/pids/delayed_job.pid 
    start program = "cd /var/www/myapp/current && script/delayed_job start RAILS_ENV=production" 
       as uid deploy and gid www-data 
    stop program = "cd /var/www/myapp/current && script/delayed_job stop RAILS_ENV=production" 
      as uid deploy and gid www-data 
    if mem usage > 20% for 5 cycles then alert 
    if mem usage > 30% for 5 cycles then restart 

我曾嘗試做一個直接的命令以及這將不會沒有monit工作。我必須在腳本中的當前目錄/ delayed_job的開始功能,或者它拋出一個錯誤,如..

/var/www/myapp/current/script/delayed_job start RAILS_ENV=production 

/usr/local/lib/ruby/1.8/fileutils.rb:243:in `mkdir': Permission denied - log (Errno::EACCES) 
    from /usr/local/lib/ruby/1.8/fileutils.rb:243:in `fu_mkdir' 
    from /usr/local/lib/ruby/1.8/fileutils.rb:217:in `mkdir_p' 
    from /usr/local/lib/ruby/1.8/fileutils.rb:215:in `reverse_each' 
    from /usr/local/lib/ruby/1.8/fileutils.rb:215:in `mkdir_p' 
    from /usr/local/lib/ruby/1.8/fileutils.rb:201:in `each' 
    from /usr/local/lib/ruby/1.8/fileutils.rb:201:in `mkdir_p' 
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/buffered_logger.rb:51:in `initialize' 
    from /var/www/myapp/releases/20101001032406/config/initializers/dj.rb:4:in `new' 
    from /var/www/myapp/releases/20101001032406/config/initializers/dj.rb:4 
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load_without_new_constant_marking' 
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:147:in `load' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in `load_application_initializers' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `each' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:621:in `load_application_initializers' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:176:in `process' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `send' 
    from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:113:in `run' 
    from /var/www/myapp/current/config/environment.rb:10 
    from /var/www/myapp/current/script/delayed_job:3:in `require' 
    from /var/www/myapp/current/script/delayed_job:3 

monit的狀態只是說執行失敗。

+0

有你的目錄中登錄您的Rails.root? – shingara 2010-10-01 07:30:35

+0

對不起,我不明白。日誌是在/ var/WWW/MYAPP /共享/日誌 – badnaam 2010-10-01 07:31:44

回答

0

我想這是日誌目錄應該是在/ var/WWW/MYAPP /電流/和DJ試圖寫它之前的mkdir。最有可能的是,用戶'deploy'沒有寫入/ var/www/myapp/current的權限。

+0

Hmm..no,部署自己的currrent目錄 – badnaam 2010-10-01 15:30:53

+0

我接受了答案,雖然它是不完全的情況下,把我帶到正確的方向。謝謝 – badnaam 2010-10-03 05:35:27

+0

@badnaam你的情況實際上是什麼?你可以分享,這樣可以幫助追隨者嗎? – 2012-08-03 01:45:03

-1

的問題是我在DJ初始化以下,有DJ登錄到常規軌道記錄(不BTW發生)。一旦我評論它就解決了。

Delayed::Worker.logger = ActiveSupport::BufferedLogger.new("log/{Rails.env}_delayed_jobs.log##", Rails.logger.level) 
Delayed::Worker.logger.auto_flushing = 1