This commit is contained in:
chiu 2020-02-20 13:27:19 +08:00
parent a70a22d436
commit df65b00ff8
2 changed files with 2 additions and 3 deletions

View File

@ -196,9 +196,8 @@ class Admin::SitesController < OrbitAdminController
def restart_server def restart_server
mode = Rails.env mode = Rails.env
unicorn_rails = %x[which unicorn_rails].sub("\n",'') unicorn_rails = %x[which unicorn_rails].sub("\n",'')
Bundler.with_clean_env{system("kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}")}
sleep 2
render :nothing => true render :nothing => true
Bundler.with_clean_env{system("kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && sleep 1 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}")}
end end
private private

View File

@ -172,7 +172,7 @@ class Admin::PlaygroundController < OrbitAdminController
def restart_unicorn(mode) def restart_unicorn(mode)
mode = Rails.env if mode.nil? mode = Rails.env if mode.nil?
unicorn_rails = %x[which unicorn_rails].sub("\n",'') unicorn_rails = %x[which unicorn_rails].sub("\n",'')
content = "kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now" content = "kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && sleep 1 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now"
Thread.new do Thread.new do
Bundler.with_clean_env{system(content)} Bundler.with_clean_env{system(content)}
end end