From 10b6a4ec2510ff07515a785f9002d1fc72eb3b30 Mon Sep 17 00:00:00 2001 From: Bohung Date: Fri, 3 Dec 2021 11:12:40 +0800 Subject: [PATCH] Fix bug. --- lib/tasks/detect_sites.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/detect_sites.rake b/lib/tasks/detect_sites.rake index 1153519..75ec0b0 100644 --- a/lib/tasks/detect_sites.rake +++ b/lib/tasks/detect_sites.rake @@ -65,7 +65,8 @@ namespace :create_site do end server_name = server_name_list.join(' ') nginx_file_content = exec_ssh_command_by_sudo_and_see_output(ssh,"cat #{nginx_file}",false,true) - site_path = Pathname.new(exec_ssh_command_by_sudo_and_see_output(ssh,"echo `grep root #{nginx_file} | grep -v -e '#.*root'`",false,true).to_s.split("\n").first.to_s.strip.split(";").select{|s| s.present? && s.include?("root")}.first.split("root").last.to_s.strip).dirname.to_s + site_path = Pathname.new(exec_ssh_command_by_sudo_and_see_output(ssh,"echo `grep root #{nginx_file} | grep -v -e '#.*root'`",false,true).to_s.split("\n").first.to_s.strip.split(";").select{|s| s.present? && s.include?("root")}.first.split("root").last.to_s.strip).dirname.to_s rescue nil + next if site_path.nil? if site_path.present? && exec_ssh_command_by_sudo(ssh,"ls #{site_path}").split.length != 0 && exec_ssh_command_by_sudo(ssh,"ls #{site_path}/Gemfile").include?("No such file or directory") SiteConstruct.where(:server_type => @site_server.server_name , :domain_name=>server_name).destroy next