From a509edff224ef00d3858a20a2176135a944a690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=AC=E5=93=A5=E4=BE=83=E4=BE=83=E4=BE=83ygkkk?= <121604513+yonggekkk@users.noreply.github.com> Date: Fri, 7 Mar 2025 15:26:32 +0800 Subject: [PATCH] Update serv00keep.sh --- serv00keep.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/serv00keep.sh b/serv00keep.sh index 748e06b..5c34058 100644 --- a/serv00keep.sh +++ b/serv00keep.sh @@ -54,7 +54,7 @@ ym=("$HOSTNAME" "cache$nb.serv00.com" "web$nb.serv00.com") rm -rf ip.txt for host in "${ym[@]}"; do response=$(curl -sL --connect-timeout 5 --max-time 7 "https://ss.fkj.pp.ua/api/getip?host=$host") -if [[ "$response" =~ ^$|unknown|not|error ]]; then +if [[ "$response" =~ (unknown|not|error) ]]; then dig @8.8.8.8 +time=5 +short $host | sort -u >> ip.txt sleep 1 else @@ -67,7 +67,9 @@ fi done <<< "$response" fi done -grep ':' ip.txt | sort -u -o ip.txt +if [[ ! "$response" =~ (unknown|not|error) ]]; then +grep ':' $WORKDIR/ip.txt | sort -u -o $WORKDIR/ip.txt +fi if [[ -z "$IP" ]]; then IP=$(grep -m 1 "可用" ip.txt | awk -F ':' '{print $1}') if [ -z "$IP" ]; then