This commit is contained in:
chiu 2020-02-15 09:09:18 +08:00
parent a465c81c16
commit ad38022df2
2 changed files with 6 additions and 4 deletions

View File

@ -30,6 +30,7 @@ all_template.each do |folder|
end end
end end
if old_gemfile_text != new_gemfile_text if old_gemfile_text != new_gemfile_text
unicorn_rails = %x[which unicorn_rails].sub("\n",'')
puts 'updating gemfile' puts 'updating gemfile'
File.open(ENV['PWD']+'/Gemfile', 'w') do |file| File.open(ENV['PWD']+'/Gemfile', 'w') do |file|
file.write new_gemfile_text file.write new_gemfile_text
@ -63,7 +64,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
all_command = "#{command1} && screen -d -m -S auto_reopen watch -n 30 bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode} && kill -s TERM `cat tmp/pids/unicorn.pid` && bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}|at now" all_command = "#{command1} && screen -d -m -S auto_reopen watch -n 30 bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} && kill -s TERM `cat tmp/pids/unicorn.pid` && 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']
@ -71,7 +72,9 @@ if old_gemfile_text != new_gemfile_text
exec(all_command) exec(all_command)
end end
end end
a.priority = 2 now_priority = Thread.current.priority.to_i
a.priority = now_priority + 2
puts a.priority
sleep 2 sleep 2
a.run a.run
#Thread.exit #Thread.exit

View File

@ -169,8 +169,7 @@ class Admin::PlaygroundController < OrbitAdminController
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` && bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode} | at now"
system("bundle exec #{unicorn_rails} -c #{ENV['PWD']}/config/unicorn.rb -D -E #{mode} | at now +1 minute") exec_other_command(content)
exec_other_command(content)
end end
def check_for_testers def check_for_testers