This commit is contained in:
BOYA,CHIU 2021-08-11 16:16:21 +08:00
parent 21601fee18
commit 111fe5ef98
2 changed files with 5 additions and 2 deletions

View File

@ -5,6 +5,7 @@ $:.push File.expand_path("../lib", __FILE__)
require "announcement/version" require "announcement/version"
require 'json' require 'json'
bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install' bundle_update_flag = ARGV[0]=='update' || ARGV[0]=='install'
puts ['rails_env',ENV.to_h]
if bundle_update_flag if bundle_update_flag
env_pwd = ENV['PWD'] env_pwd = ENV['PWD']
if File.exist?("#{env_pwd}/app/models/google.rb") if File.exist?("#{env_pwd}/app/models/google.rb")
@ -200,11 +201,13 @@ if bundle_update_flag
#file.write(all_command) #file.write(all_command)
#file.chmod(0755) #file.chmod(0755)
#file.close #file.close
restart_cmd = "UNICORN_PID=\"`fuser fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s TERM $UNICORN_PID ; while (kill -0 $UNICORN_PID > /dev/null 2>&1) ; do printf '.' && sleep 1 ; done ; unset UNICORN_FD; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}"
a = Thread.start do a = Thread.start do
Bundler.with_clean_env do Bundler.with_clean_env do
puts env_pwd puts env_pwd
puts mode puts mode
exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} kill -s TERM `cat tmp/pids/unicorn.pid` ; unset UNICORN_FD ; bundle exec #{unicorn_rails} -c config/unicorn.rb -D -E #{mode};#{watch_dog_cmd}\" ") exec("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} #{restart_cmd};#{watch_dog_cmd}\" ")
end end
end end
now_priority = Thread.current.priority.to_i now_priority = Thread.current.priority.to_i

View File

@ -59,6 +59,7 @@ class AnnouncementsController < ApplicationController
a a
end end
end end
params = OrbitHelper.params
if anns.count == 0 && params.any?{|k,v| v.class==Array ? v.any?{|v1| v1.to_s.match(/\*|\(|\)/)} : v.to_s.match(/\*|\(|\)/)} if anns.count == 0 && params.any?{|k,v| v.class==Array ? v.any?{|v1| v1.to_s.match(/\*|\(|\)/)} : v.to_s.match(/\*|\(|\)/)}
return nil return nil
end end
@ -68,7 +69,6 @@ class AnnouncementsController < ApplicationController
end end
# anns = anns.concat(feeds_anns) # anns = anns.concat(feeds_anns)
# total_pages = announcements.total_pages # total_pages = announcements.total_pages
params = OrbitHelper.params
page = Page.where(url:params['url']).first page = Page.where(url:params['url']).first
@annc_page_title = nil @annc_page_title = nil
if (params['category'] != page.categories rescue true) if (params['category'] != page.categories rescue true)