This commit is contained in:
BoHung Chiu 2022-10-25 10:43:05 +08:00
parent aa948dc590
commit 97ec8056d6
2 changed files with 6 additions and 2 deletions

View File

@ -25,6 +25,8 @@ if [[ ! -z "$9" ]]; then
if [[ -z "$new_server_port" ]]; then if [[ -z "$new_server_port" ]]; then
new_server_port="80"; new_server_port="80";
fi fi
else
new_server_port="80";
fi fi
fi fi
domain_escape=`echo $domain|sed 's/\./\\\./g'`; domain_escape=`echo $domain|sed 's/\./\\\./g'`;
@ -38,7 +40,7 @@ else
ssh_command="sshpass -p $pass ssh $user@$ip -p $port"; ssh_command="sshpass -p $pass ssh $user@$ip -p $port";
scp_command="sshpass -p $pass scp -r -P $port $user@$ip:"; scp_command="sshpass -p $pass scp -r -P $port $user@$ip:";
scan_ssh_keys=`ssh-keyscan -H $ip -p $port` scan_ssh_keys=`ssh-keyscan -H $ip -p $port`
if [ -z "$(grep -w "$scan_ssh_keys" ~/.ssh/known_hosts)" ]; then if [[ ! -e ~/.ssh/known_hosts ]] || [[ -z "$(grep -w "$scan_ssh_keys" ~/.ssh/known_hosts)" ]]; then
echo "$scan_ssh_keys" >> ~/.ssh/known_hosts echo "$scan_ssh_keys" >> ~/.ssh/known_hosts
fi fi
use_local_command="" use_local_command=""

View File

@ -28,6 +28,8 @@ if [[ ! -z "$tmp" ]]; then
if [[ -z "$new_server_port" ]]; then if [[ -z "$new_server_port" ]]; then
new_server_port="80"; new_server_port="80";
fi fi
else
new_server_port="80";
fi fi
fi fi
tmp=""; tmp="";
@ -42,7 +44,7 @@ else
ssh_command="sshpass -p $pass ssh $user@$ip -p $port"; ssh_command="sshpass -p $pass ssh $user@$ip -p $port";
scp_command="sshpass -p $pass scp -r -P $port $user@$ip:"; scp_command="sshpass -p $pass scp -r -P $port $user@$ip:";
scan_ssh_keys=`ssh-keyscan -H $ip -p $port` scan_ssh_keys=`ssh-keyscan -H $ip -p $port`
if [ -z "$(grep -w "$scan_ssh_keys" ~/.ssh/known_hosts)" ]; then if [[ ! -e ~/.ssh/known_hosts ]] || [[ -z "$(grep -w "$scan_ssh_keys" ~/.ssh/known_hosts)" ]]; then
echo "$scan_ssh_keys" >> ~/.ssh/known_hosts echo "$scan_ssh_keys" >> ~/.ssh/known_hosts
fi fi
use_local_command="" use_local_command=""