如何手动重启独角兽

问题描述:

当我运行 cap deploy 时,我不确定 unicorn 是否正确重启,因为应用程序中没有显示某些更改,因此我想在我的远程服务器上手动重启 unicorn.我已经导航到 etc/init.d 并看到 unicorn_myapp 的列表,但它不是目录(即我无法 cd 进入它).根据我的 deploy.rb 文件中的以下代码,我可以从这里做些什么来重新启动独角兽?

I'm not confident that unicorn is restarting properly when I run cap deploy as certain changes are not showing in the app, therefore I wanted to restart unicorn manually on my remote server. I have navigated into etc/init.d and see a listing for unicorn_myapp but it's not a directory (i.e. I can't cd into it). Based on the code below from my deploy.rb file, is there something I can do from here to restart unicorn?

我尝试执行 run unicorn_myapp restart 但它说 run 不是命令

I tried to do run unicorn_myapp restart but it said run isn't a command

namespace :deploy do
  %w[start stop restart].each do |command|
    desc "#{command} unicorn server"
    task command, roles: :app, except: {no_release: true} do
      run "/etc/init.d/unicorn_#{application} #{command}"
    end
  end

您没有列出操作系统.但以下之一应该有效.

you didn't list the OS. but one of the following should work.

你需要是 root/使用 sudo

you will need to be root / use sudo

/etc/init.d/unicorn_myapp restart 


/etc/init.d/unicorn_myapp stop 
/etc/init.d/unicorn_myapp start 


service unicorn_myapp restart

service unicorn_myapp stop
service unicorn_myapp start

首先尝试重启版本,但根据 init 脚本的编写方式,它可能没有重启命令,如果不起作用,您可以执行停止/启动版本.

Try the restart versions first, but depending upon how the init script was written it might not have a restart command, if that doesn't work you can do the stop / start version.