This commit is contained in:
BoHung Chiu 2022-09-06 22:50:31 +08:00
parent dfcc4fb852
commit 39414f747d
2 changed files with 20 additions and 6 deletions

View File

@ -20,6 +20,9 @@ if [[ ! -z "$9" ]]; then
new_server_name="$(echo "$9"|sed 's/:.\+//g')"; new_server_name="$(echo "$9"|sed 's/:.\+//g')";
if [[ ! -z "$(echo "$9"|grep ':')" ]]; then if [[ ! -z "$(echo "$9"|grep ':')" ]]; then
new_server_port="$(echo "$9"|sed 's/[^:]\+://g')"; new_server_port="$(echo "$9"|sed 's/[^:]\+://g')";
if [[ -z "$new_server_port" ]]; then
new_server_port="80";
fi
fi fi
fi fi
domain_escape=`echo $domain|sed 's/\./\\\./g'`; domain_escape=`echo $domain|sed 's/\./\\\./g'`;
@ -39,8 +42,8 @@ else
use_local_command="" use_local_command=""
fi fi
nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`; 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 ''" remote_sudo_command="echo $pass|sudo -S -p ' '"
alias sudo_command="echo $user_pass|sudo -S -p ''" alias sudo_command="echo $user_pass|sudo -S -p ' '"
if [ -z "$(which sshpass)" ]; then if [ -z "$(which sshpass)" ]; then
sudo_command apt install sshpass -y; sudo_command apt install sshpass -y;
fi fi
@ -158,10 +161,14 @@ else
echo "Nginx setting has some problem!"; echo "Nginx setting has some problem!";
echo "Please restart nginx by yourself!"; echo "Please restart nginx by yourself!";
fi fi
rm -f Gemfile.lock
bundle install bundle install
rm -f tmp/unicorn.sock tmp/pids/unicorn.pid 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 "Finish moving and installing site!"
echo "Site Path: $local_store_path"
exit_command 0; exit_command 0;
fi fi
fi fi

View File

@ -25,6 +25,9 @@ if [[ ! -z "$tmp" ]]; then
new_server_name="$(echo "$tmp"|sed 's/:.\+//g')"; new_server_name="$(echo "$tmp"|sed 's/:.\+//g')";
if [[ ! -z "$(echo "$tmp"|grep ':')" ]]; then if [[ ! -z "$(echo "$tmp"|grep ':')" ]]; then
new_server_port="$(echo "$tmp"|sed 's/[^:]\+://g')"; new_server_port="$(echo "$tmp"|sed 's/[^:]\+://g')";
if [[ -z "$new_server_port" ]]; then
new_server_port="80";
fi
fi fi
fi fi
tmp=""; tmp="";
@ -45,8 +48,8 @@ else
use_local_command="" use_local_command=""
fi fi
nginx_file=`$ssh_command "grep -e $'\s''$domain_escape' /etc/nginx/orbit_sites/* -l"|xargs|awk '{print $1}'`; 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 ''" remote_sudo_command="echo $pass|sudo -S -p ' '"
alias sudo_command="echo $user_pass|sudo -S -p ''" alias sudo_command="echo $user_pass|sudo -S -p ' '"
if [ -z "$(which sshpass)" ]; then if [ -z "$(which sshpass)" ]; then
sudo_command apt install sshpass -y; sudo_command apt install sshpass -y;
fi fi
@ -164,10 +167,14 @@ else
echo "Nginx setting has some problem!"; echo "Nginx setting has some problem!";
echo "Please restart nginx by yourself!"; echo "Please restart nginx by yourself!";
fi fi
rm -f Gemfile.lock
bundle install bundle install
rm -f tmp/unicorn.sock tmp/pids/unicorn.pid 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 "Finish moving and installing site!"
echo "Site Path: $local_store_path"
exit_command 0; exit_command 0;
fi fi
fi fi