Fix IP check for the case where all services fail

Last commit would still not fix the problem if all services fails
because of the check on line 38.
This commit is contained in:
Harald Ringvold 2021-03-20 21:14:24 +01:00
parent 9b59388a58
commit 928616e9e0

View file

@ -29,9 +29,8 @@ while ( true ); do
for service in ${services[@]}; do for service in ${services[@]}; do
echo "Trying with $service..." echo "Trying with $service..."
ip="$(curl -s $service)" ip="$(curl -s $service | grep '[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}')"
valid_ip=$(echo $ip | grep '[0-9]\{1,3\}\(\.[0-9]\{1,3\}\)\{3\}') test -n "$ip" && break
test -n "$valid_ip" && break
done done
echo "Found IP address $ip" echo "Found IP address $ip"