From 39414f747d1d214946e992a93135a1ed05948b2c Mon Sep 17 00:00:00 2001 From: bohung Date: Tue, 6 Sep 2022 22:50:31 +0800 Subject: [PATCH] Fix bug. --- move_site.sh | 13 ++++++++++--- move_site_interactive.sh | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/move_site.sh b/move_site.sh index c1a15f2..f611495 100644 --- a/move_site.sh +++ b/move_site.sh @@ -20,6 +20,9 @@ if [[ ! -z "$9" ]]; then new_server_name="$(echo "$9"|sed 's/:.\+//g')"; if [[ ! -z "$(echo "$9"|grep ':')" ]]; then new_server_port="$(echo "$9"|sed 's/[^:]\+://g')"; + if [[ -z "$new_server_port" ]]; then + new_server_port="80"; + fi fi fi domain_escape=`echo $domain|sed 's/\./\\\./g'`; @@ -39,8 +42,8 @@ else use_local_command="" fi nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`; -remote_sudo_command="echo $pass|sudo -S -p ''" -alias sudo_command="echo $user_pass|sudo -S -p ''" +remote_sudo_command="echo $pass|sudo -S -p ' '" +alias sudo_command="echo $user_pass|sudo -S -p ' '" if [ -z "$(which sshpass)" ]; then sudo_command apt install sshpass -y; fi @@ -158,10 +161,14 @@ else echo "Nginx setting has some problem!"; echo "Please restart nginx by yourself!"; fi + rm -f Gemfile.lock bundle install rm -f tmp/unicorn.sock tmp/pids/unicorn.pid - bundle exec unicorn_rails -c config/unicorn.rb -E production + wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/start_site.sh -O start_site.sh + wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/close_site.sh -O close_site.sh + bash ./start_site.sh production echo "Finish moving and installing site!" + echo "Site Path: $local_store_path" exit_command 0; fi fi \ No newline at end of file diff --git a/move_site_interactive.sh b/move_site_interactive.sh index 084f983..e5d2c2e 100644 --- a/move_site_interactive.sh +++ b/move_site_interactive.sh @@ -25,6 +25,9 @@ if [[ ! -z "$tmp" ]]; then new_server_name="$(echo "$tmp"|sed 's/:.\+//g')"; if [[ ! -z "$(echo "$tmp"|grep ':')" ]]; then new_server_port="$(echo "$tmp"|sed 's/[^:]\+://g')"; + if [[ -z "$new_server_port" ]]; then + new_server_port="80"; + fi fi fi tmp=""; @@ -45,8 +48,8 @@ else use_local_command="" fi nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`; -remote_sudo_command="echo $pass|sudo -S -p ''" -alias sudo_command="echo $user_pass|sudo -S -p ''" +remote_sudo_command="echo $pass|sudo -S -p ' '" +alias sudo_command="echo $user_pass|sudo -S -p ' '" if [ -z "$(which sshpass)" ]; then sudo_command apt install sshpass -y; fi @@ -164,10 +167,14 @@ else echo "Nginx setting has some problem!"; echo "Please restart nginx by yourself!"; fi + rm -f Gemfile.lock bundle install rm -f tmp/unicorn.sock tmp/pids/unicorn.pid - bundle exec unicorn_rails -c config/unicorn.rb -E production + wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/start_site.sh -O start_site.sh + wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/close_site.sh -O close_site.sh + bash ./start_site.sh production echo "Finish moving and installing site!" + echo "Site Path: $local_store_path" exit_command 0; fi fi \ No newline at end of file