This commit is contained in:
BoHung Chiu 2022-09-24 11:59:23 +08:00
parent 4c1f6be6fc
commit 2719334953
2 changed files with 12 additions and 16 deletions

View File

@ -8,6 +8,8 @@ if [ -z "$6" ]; then
history -c
exit 1;
fi
org_pwd="$(pwd)"
local_ip=`ip route get 8.8.8.8|xargs|awk '{print $7}'`;
ip="$1";
port="$2";
user="$3";
@ -66,7 +68,7 @@ else
echo "$domain not found in nginx file!";
echo "Please Check ip and domain is correct";
else
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'"`;
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'|xargs|awk '{print \\$1}'"`;
echo "root_path: $root_path";
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
if [ -z $db_name ]; then
@ -105,11 +107,8 @@ else
fi
local_store_path="$HOME/orbit_sites/$new_site_name"
mkdir -p "$local_store_path"
if [[ -z "$use_local_command" ]]; then
$scp_command$root_path/{*,.[^.]*} $local_store_path/. 2>>/dev/null
else
$scp_command$root_path/{*,.[^.]*} $local_store_path/. 2>>/dev/null
fi
$scp_command$root_path/* $local_store_path/. 2>>/dev/null
$scp_command$root_path/.[^.]* $local_store_path/. 2>>/dev/null
cd $local_store_path
new_nginx_file="/etc/nginx/orbit_sites/$new_site_name"
sudo_command cp -f "$(basename $nginx_file)" $new_nginx_file
@ -122,8 +121,8 @@ else
wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/install_certbot.sh
sudo_command bash ./install_certbot.sh
fi
sudo_command sudo cp -r $new_ssl_dir/* $org_ssl_dir/.
sudo_command sudo cp -r $new_ssl_dir/renewal/* /etc/letsencrypt/renewal/.
sudo_command cp -r $new_ssl_dir/* $org_ssl_dir/.
sudo_command cp -r $new_ssl_dir/renewal/* /etc/letsencrypt/renewal/.
else
sed "s/$(escape_slash $ssl_certificate_file)/$(escape_slash $root_path)\/ssl_files\/$(basename $ssl_certificate_file)/g" -i $new_nginx_file
sed "s/$(escape_slash $ssl_certificate_key_file)/$(escape_slash $root_path)\/ssl_files\/$(basename $ssl_certificate_key_file)/g" -i $new_nginx_file

View File

@ -72,7 +72,7 @@ else
echo "$domain not found in nginx file!";
echo "Please Check ip and domain is correct";
else
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'"`;
root_path=`$ssh_command "cat '$nginx_file'|grep -E '(^|^\s+)root'|sed -E 's/(^|^\s+)root\s+//'|tr ';' ' '|awk '{print \\$1}'|sed 's/\/public$//g'|xargs|awk '{print \\$1}'"`;
echo "root_path: $root_path";
db_name=`$ssh_command "grep -w 'database' '$root_path/config/mongoid.yml' -m1|sed 's/database://g'| xargs"`
if [ -z $db_name ]; then
@ -111,11 +111,8 @@ else
fi
local_store_path="$HOME/orbit_sites/$new_site_name"
mkdir -p "$local_store_path"
if [[ -z "$use_local_command" ]]; then
$scp_command$root_path/{*,.[^.]*} $local_store_path/. 2>>/dev/null
else
$scp_command$root_path/{*,.[^.]*} $local_store_path/. 2>>/dev/null
fi
$scp_command$root_path/* $local_store_path/. 2>>/dev/null
$scp_command$root_path/.[^.]* $local_store_path/. 2>>/dev/null
cd $local_store_path
new_nginx_file="/etc/nginx/orbit_sites/$new_site_name"
sudo_command cp -f "$(basename $nginx_file)" $new_nginx_file
@ -128,8 +125,8 @@ else
wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/install_certbot.sh
sudo_command bash ./install_certbot.sh
fi
sudo_command sudo cp -r $new_ssl_dir/* $org_ssl_dir/.
sudo_command sudo cp -r $new_ssl_dir/renewal/* /etc/letsencrypt/renewal/.
sudo_command cp -r $new_ssl_dir/* $org_ssl_dir/.
sudo_command cp -r $new_ssl_dir/renewal/* /etc/letsencrypt/renewal/.
else
sed "s/$(escape_slash $ssl_certificate_file)/$(escape_slash $root_path)\/ssl_files\/$(basename $ssl_certificate_file)/g" -i $new_nginx_file
sed "s/$(escape_slash $ssl_certificate_key_file)/$(escape_slash $root_path)\/ssl_files\/$(basename $ssl_certificate_key_file)/g" -i $new_nginx_file