fix the error that cannot reopen the site after kill the site

This commit is contained in:
chiu 2020-02-18 13:49:10 +08:00
parent b1e158e7e8
commit f5aff775ba
3 changed files with 4 additions and 4 deletions

View File

@ -80,7 +80,7 @@ if old_gemfile_text != new_gemfile_text
else else
command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && mv -f Gemfile.lock Gemfile.lock.bak123 && bundle update" command1 = "cd #{env_pwd} && gem install bundler -v 1.17.3 && mv -f Gemfile.lock Gemfile.lock.bak123 && bundle update"
end 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") filedata = File.read(env_pwd+"/built_in_extensions.rb")
exist_str = "gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git'" exist_str = "gem 'patchfile', git: 'http://gitlab.tp.rulingcom.com/chiu/patch_file.git'"
if filedata.include? exist_str if filedata.include? exist_str
@ -91,7 +91,7 @@ if old_gemfile_text != new_gemfile_text
f.puts exist_str f.puts exist_str
} }
end 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 a = Thread.start do
Bundler.with_clean_env do Bundler.with_clean_env do
puts env_pwd puts env_pwd

View File

@ -51,7 +51,7 @@ gem 'impressionist', '~> 1.5.2'
gem 'chartkick', '~> 2.3.5' gem 'chartkick', '~> 2.3.5'
gem 'usagewatch_ext' gem 'usagewatch_ext'
gem 'ckeditor', '~> 4.2.4' gem 'ckeditor', '~> 4.2.4'
gem 'unicorn', '~> 5.4.0' gem 'unicorn', '~> 5.4.1'
gem 'zhconv' gem 'zhconv'
gem 'time_difference' gem 'time_difference'
gem 'execjs' gem 'execjs'

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` && 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 Thread.new do
Bundler.with_clean_env{system(content)} Bundler.with_clean_env{system(content)}
end end