let the first time update message can be get in process

This commit is contained in:
chiu 2020-02-22 22:37:22 +08:00
parent 34dfd00afe
commit d203c115c5
3 changed files with 9 additions and 9 deletions

View File

@ -90,17 +90,17 @@ if old_gemfile_text != new_gemfile_text
f.puts exist_str
}
end
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.write(all_command)
file.chmod(0755)
file.close
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"
watch_dog_cmd = "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.write(all_command)
#file.chmod(0755)
#file.close
a = Thread.start do
Bundler.with_clean_env do
puts env_pwd
puts mode
exec("cd #{env_pwd} && screen -d -m -S auto_reopen_#{dir_name} #{env_pwd}/bundle_update_background.sh ")
exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ; screen -d -m -S auto_reopen_#{dir_name} #{watch_dog_cmd} ")
end
end
now_priority = Thread.current.priority.to_i

View File

@ -1,5 +1,5 @@
source 'https://rubygems.org'
#fix update manager error!!!!!!!!
#update all site!!!!!!!!
#social gems
gem "omniauth-google-oauth2"

View File

@ -184,7 +184,7 @@ class Admin::SitesController < OrbitAdminController
if %x[git config user.email].empty?
%x[git config --global user.email "orbit@rulingcom.com"]
end
Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_all_program} && #{git} reset #{commit} --merge && #{git_add_custom} && #{git_restore} && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now}")}
Bundler.with_clean_env{system("#{git_add_except_public} && #{git} commit -m auto_backup_before_#{type}_#{time_now} && #{git} reset #{commit} --mixed && #{git_add_all_program} && #{git} reset #{commit} --merge && #{git_add_custom} && #{git_restore} && #{git_add_except_public}&& #{git} commit -m complete_#{type}_#{time_now} && cp -rf public/assets public/assets_back && rm -rf public/assets")}
mul.update_attributes(status: 'finish')
end
end