try to fix

This commit is contained in:
chiu 2020-02-21 16:24:39 +08:00
parent 6a3dc5013f
commit 62d3e08024
1 changed files with 5 additions and 4 deletions

View File

@ -76,9 +76,9 @@ if old_gemfile_text != new_gemfile_text
Bundler.with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]} Bundler.with_clean_env{%x[screen -ls | grep auto_reopen_#{dir_name} | cut -d. -f1 | awk '{print $1}' | xargs kill]}
end end
if files.count ==0 if files.count ==0
command1 = "cd #{env_pwd} ; gem install bundler -v 1.17.3 ; bundle update --force" command1 = "gem install bundler -v 1.17.3 ; bundle update --force"
else else
command1 = "cd #{env_pwd} ; gem install bundler -v 1.17.3 ; mv -f Gemfile.lock Gemfile.lock.bak123 ; bundle update --force" command1 = "gem install bundler -v 1.17.3 ; mv -f Gemfile.lock Gemfile.lock.bak123 ; bundle update --force"
end end
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'"
@ -90,7 +90,8 @@ 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` ; unset UNICORN_FD ; bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now" all_command = "#{command1} ; #{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;"
all_command = all_command + "watch -n 30 \"unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now\""
#file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w") #file = File.new(File.join(env_pwd,'bundle_update_background.sh'),"w")
#file.write(all_command) #file.write(all_command)
#file.chmod(0755) #file.chmod(0755)
@ -99,7 +100,7 @@ if old_gemfile_text != new_gemfile_text
Bundler.with_clean_env do Bundler.with_clean_env do
puts env_pwd puts env_pwd
puts mode puts mode
exec("cd #{env_pwd} && screen -d -m -S bundle_update_#{dir_name} bash -c \"#{all_command}\" && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 \"unset UNICORN_FD && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode}|at now\"") exec("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{all_command}\"")
end end
end end
now_priority = Thread.current.priority.to_i now_priority = Thread.current.priority.to_i