fix(脚本): 修复无法识别ip的bug、以及执行错误排查报错信息问题

pull/534/merge
mack-a 2020-10-19 20:14:23 +08:00
parent c312271e03
commit 0473832915
1 changed files with 1 additions and 5 deletions

View File

@ -264,11 +264,7 @@ initTLSNginxConfig(){
}
# 检查ip
checkIP(){
pingIP=`ping -c 1 -W 1000 ${domain}|awk '{print $4}'|head -2|tail -n 1`
if [[ ! -z "${pingIP}" ]]
then
pingIP=`echo ${pingIP}|awk -F "[.]" '{print $1"."$2"."$3"."$4}'`
fi
pingIP=`ping -c 1 -W 1000 ${domain}|sed '1{s/[^(]*(//;s/).*//;q}'`
if [[ ! -z "${pingIP}" ]] && [[ `echo ${pingIP}|grep '^\([1-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)$'` ]]
then
read -p "当前域名的IP为 [${pingIP}],是否正确[y/n]" domainStatus