From df65b00ff86ebc227e0686f0665e20d41526c262 Mon Sep 17 00:00:00 2001 From: chiu Date: Thu, 20 Feb 2020 13:27:19 +0800 Subject: [PATCH] try --- temp_file/app/controllers/admin/sites_controller.rb | 3 +-- temp_file/playground_controller.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/temp_file/app/controllers/admin/sites_controller.rb b/temp_file/app/controllers/admin/sites_controller.rb index 1dd57ac..fe99b81 100644 --- a/temp_file/app/controllers/admin/sites_controller.rb +++ b/temp_file/app/controllers/admin/sites_controller.rb @@ -196,9 +196,8 @@ class Admin::SitesController < OrbitAdminController def restart_server mode = Rails.env 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 + 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 private diff --git a/temp_file/playground_controller.rb b/temp_file/playground_controller.rb index 851ebfa..665e82e 100644 --- a/temp_file/playground_controller.rb +++ b/temp_file/playground_controller.rb @@ -172,7 +172,7 @@ class Admin::PlaygroundController < OrbitAdminController def restart_unicorn(mode) mode = Rails.env if mode.nil? 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 Bundler.with_clean_env{system(content)} end