Ruby on rails Capistrano未重新启动nginx

Ruby on rails Capistrano未重新启动nginx,ruby-on-rails,capistrano,Ruby On Rails,Capistrano,我已经安装了Capistrano,一切正常,除了Capistrano在部署后没有重新启动乘客。每次部署后,我都必须使用ssh连接到服务器并在当前目录中键入触摸tmp/restart.txt。我尝试了不同的方法重新启动乘客,但没有任何效果 第一次尝试: namespace :deploy do task :restart do on roles(:app) do run "#{try_sudo} touch #{File.join(current_path,'tmp','r

我已经安装了Capistrano,一切正常,除了Capistrano在部署后没有重新启动乘客。每次部署后,我都必须使用ssh连接到服务器并在
当前目录中键入
触摸tmp/restart.txt
。我尝试了不同的方法重新启动乘客,但没有任何效果

第一次尝试:

namespace :deploy do
  task :restart do
    on roles(:app) do
      run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    end
  end
end
第二次尝试

namespace :deploy do
  task :restart do
    on roles(:app) do
      within current_path do
         execute :touch, 'tmp/restart.txt'
      end
    end
  end
end
namespace :deploy do
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
end
第三次尝试

namespace :deploy do
  task :restart do
    on roles(:app) do
      within current_path do
         execute :touch, 'tmp/restart.txt'
      end
    end
  end
end
namespace :deploy do
  task :restart do
    run "touch #{current_path}/tmp/restart.txt"
  end
end
我在stackoverflow中发现了与我类似的问题,但没有一个是重新启动服务器


我正在使用
capistrano(3.4.0)
Rails 4
(nginx+passenger)

可能是您的
deploy:restart
任务没有执行

Capistrano 3.1.0及更高版本(如中所述)不会在
cap deploy
结束时自动执行
deploy:restart

因此,您必须通过将其添加到
deploy.rb
,明确告知Capistrano这样做:

after 'deploy:publishing', 'deploy:restart'

您好,我的
deploy:restart
未执行。我会在下班后尝试你的建议,晚上会告诉你最新情况。谢谢