try to fix not updating error

This commit is contained in:
chiu 2020-02-21 15:37:33 +08:00
parent 62afd42e2e
commit 5cfae24800
1 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ if old_gemfile_text != new_gemfile_text
command2 = '' command2 = ''
if old_playground != new_playground if old_playground != new_playground
puts 'updating playground' puts 'updating playground'
command2 = "cp -f #{app_path}/temp_file/playground_controller.rb #{env_pwd}/app/controllers/admin/playground_controller.rb &&" command2 = "cp -f #{app_path}/temp_file/playground_controller.rb #{env_pwd}/app/controllers/admin/playground_controller.rb ;"
#File.open(ENV['PWD']+'/app/controllers/admin/playground_controller.rb', 'w') do |file| #File.open(ENV['PWD']+'/app/controllers/admin/playground_controller.rb', 'w') do |file|
# file.write new_playground # file.write new_playground
#end #end
@ -56,7 +56,7 @@ if old_gemfile_text != new_gemfile_text
command3 = '' command3 = ''
if old_multithread != new_multithread if old_multithread != new_multithread
puts 'updating multithread' puts 'updating multithread'
command3 = "cp -f #{app_path}/temp_file/multithread.rb #{env_pwd}/app/models/multithread.rb &&" command3 = "cp -f #{app_path}/temp_file/multithread.rb #{env_pwd}/app/models/multithread.rb ;"
#File.open(ENV['PWD']+'/app/models/multithread.rb', 'w') do |file| #File.open(ENV['PWD']+'/app/models/multithread.rb', 'w') do |file|
# file.write new_multithread # file.write new_multithread
#end #end
@ -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 = "cd #{env_pwd} ; 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 = "cd #{env_pwd} ; gem install bundler -v 1.17.3 ; mv -f Gemfile.lock Gemfile.lock.bak123 ; bundle update --force"
end end
Bundler.with_clean_env{system("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} watch -n 30 \"unset UNICORN_FD && bundle exec --keep-file-descriptors #{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 \"unset UNICORN_FD && 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")
@ -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` && unset UNICORN_FD && 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"
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)