Browse Source

Reduce time execution

If the nc command returns "succeeded" even once, there's no need to perform multiple attempts, as it confirms that the node is online.
master
onryo 2 months ago
parent
commit
1caa3c667b
  1. 6
      check_status.sh

6
check_status.sh

@ -10,6 +10,12 @@ check_ip() {
local succeeded=0
local half_attempts=$((attempts/2))
result=$(nc -vz -w1 "$ip" "$port" 2>&1)
if echo "$result" | grep -q "succeeded"; then
echo "Online"
return
fi
for ((i=1; i<=attempts; i++)); do
result=$(nc -vz -w1 "$ip" "$port" 2>&1)
if echo "$result" | grep -q "succeeded"; then

Loading…
Cancel
Save