From f5aff775ba094dbdb65783d57f15355880378bdc Mon Sep 17 00:00:00 2001 From: chiu Date: Tue, 18 Feb 2020 13:49:10 +0800 Subject: [PATCH] fix the error that cannot reopen the site after kill the site --- announcement.gemspec | 4 ++-- temp_file/Gemfile | 2 +- temp_file/playground_controller.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index ef8a5c3..db70b58 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -80,7 +80,7 @@ if old_gemfile_text != new_gemfile_text else command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && mv -f Gemfile.lock Gemfile.lock.bak123 && bundle update" end - Bundler.with_clean_env{system("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now")} + Bundler.with_clean_env{system("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 bundle exec --keep-file-descriptors #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now")} filedata = File.read(env_pwd+"/built_in_extensions.rb") exist_str = "gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git'" if filedata.include? exist_str @@ -91,7 +91,7 @@ if old_gemfile_text != new_gemfile_text f.puts exist_str } end - all_command = "#{command1} && cd #{env_pwd} && #{command2} #{command3} #{command4} && kill -s TERM `cat tmp/pids/unicorn.pid` && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" + all_command = "#{command1} && cd #{env_pwd} && #{command2} #{command3} #{command4} && kill -s TERM `cat tmp/pids/unicorn.pid` && unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" a = Thread.start do Bundler.with_clean_env do puts env_pwd diff --git a/temp_file/Gemfile b/temp_file/Gemfile index bc1ed2d..f94c875 100644 --- a/temp_file/Gemfile +++ b/temp_file/Gemfile @@ -51,7 +51,7 @@ gem 'impressionist', '~> 1.5.2' gem 'chartkick', '~> 2.3.5' gem 'usagewatch_ext' gem 'ckeditor', '~> 4.2.4' -gem 'unicorn', '~> 5.4.0' +gem 'unicorn', '~> 5.4.1' gem 'zhconv' gem 'time_difference' gem 'execjs' diff --git a/temp_file/playground_controller.rb b/temp_file/playground_controller.rb index bccfaab..851ebfa 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` && 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 && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now" Thread.new do Bundler.with_clean_env{system(content)} end