From bcc584ca17bb607315d26766a8b5084354b76fd6 Mon Sep 17 00:00:00 2001 From: Bohung Date: Fri, 17 Dec 2021 09:36:01 +0800 Subject: [PATCH] Fix bug. --- lib/tasks/exec_command.rake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tasks/exec_command.rake b/lib/tasks/exec_command.rake index e603bd5..0d03044 100644 --- a/lib/tasks/exec_command.rake +++ b/lib/tasks/exec_command.rake @@ -46,14 +46,14 @@ namespace :exec_commands do elsif args.type == 'open_site' default_rails_env = 'development' enable_rails_env = ['development','production'] - rails_env = default_rails_env + rails_env = @site_construct.rails_env.blank? ? default_rails_env : @site_construct.rails_env cmd_output = exec_ssh_command_by_sudo_and_see_output(ssh,"ps -o args= -p `cat #{@site_construct.path}/#{@site_construct.site_name}/tmp/pids/unicorn.pid`",false) rescue [] enable_rails_env.each do |env| if( cmd_output[0].include?(env) rescue false) rails_env = env break elsif( cmd_output[0].include?("No such file or directory") rescue false) - site_construct.update(:status => "closed") + @site_construct.update(:status => "closed") break end end @@ -72,6 +72,8 @@ namespace :exec_commands do update_infos_for_exec("This site include an private git project.") @site_construct.update(:status =>"error") break + else + exec_ssh_command_by_sudo_and_see_output(ssh,"bundle exec unicorn_rails -c config/unicorn.rb -D -E #{rails_env}",false) end end update_infos_for_exec("finish starting #{@site_construct.site_name}")