2016-09-06 15 views
0

とdelayed_job再起動:私はそうのように私のdelayed_jobワーカーを再起動しようとしていますカピストラーノ

残念ながら
task :restart_dj do 
    on roles(:app) do 
     execute "RAILS_ENV=production #{File.join(current_path,'bin','delayed_job')} restart" 
    end 
    end 

を、私はこれを取得:

DEBUG [64a01587] Command: /usr/bin/env ln -s /home/me/rails/dino/releases/20160906142152 /home/me/rails/dino/releases/current 
    INFO [64a01587] Finished in 0.177 seconds with exit status 0 (successful). 
    INFO [713c695b] Running /usr/bin/env mv /home/me/rails/dino/releases/current /home/me/rails/dino as [email protected] 
DEBUG [713c695b] Command: /usr/bin/env mv /home/me/rails/dino/releases/current /home/me/rails/dino 
    INFO [713c695b] Finished in 0.349 seconds with exit status 0 (successful). 
    INFO [7c2e9550] Running RAILS_ENV=production /home/me/rails/dino/current/bin/delayed_job restart as [email protected] 
DEBUG [7c2e9550] Command: RAILS_ENV=production /home/me/rails/dino/current/bin/delayed_job restart 
DEBUG [7c2e9550] /home/me/rails/dino/releases/20160906142152/config/boot.rb:1:in `<top (required)>' 
DEBUG [7c2e9550] : 
DEBUG [7c2e9550] undefined local variable or method `__dir__' for main:Object 
DEBUG [7c2e9550] (
DEBUG [7c2e9550] NameError 
DEBUG [7c2e9550] ) 
DEBUG [7c2e9550]  from /home/me/rails/dino/releases/20160906142152/config/application.rb:1:in `require_relative' 
DEBUG [7c2e9550]  from /home/me/rails/dino/releases/20160906142152/config/application.rb:1:in `<top (required)>' 
DEBUG [7c2e9550]  from /home/me/rails/dino/current/config/environment.rb:2:in `require_relative' 
DEBUG [7c2e9550]  from /home/me/rails/dino/current/config/environment.rb:2:in `<top (required)>' 
DEBUG [7c2e9550]  from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
DEBUG [7c2e9550]  from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
DEBUG [7c2e9550]  from /home/me/rails/dino/current/bin/delayed_job:3:in `<main>' 

しかし、私は私の生産コンソール上RAILS_ENV=production bin/delayed_job restartを実行することができます問題ない。

私はRuby 2.3.1を使用しています。

+0

RAILS_ENV = production bin/delayed_job restart "' '実行しないでください。 – Nathan

答えて

0

エラー出力は、何が間違っているかを正確に伝えています。つまり、__dir__の意味を理解していません。

undefined local variable or method `__dir__' for main:Object 

あなたがさらに下のあなたのスタックトレースを見ると、理由は明確である:

from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 

あなたは開発中2.3.1を実行しているが、生産は1.9を使用しています。プロダクションでRubyの複数のバージョンを実行している場合、アプリケーションコードで2.3を正しく選択していません。

関連する問題