cloudflare_dns: fix #1

This commit is contained in:
Vasily Davydov 2024-06-08 13:30:50 +03:00
parent e723719db5
commit 7fb2355b1a

View File

@ -22,6 +22,13 @@ function error() {
echo "$(date --iso-8601=minutes) CLOUDFLARE_DNS_UPDATE [ERROR]: ${*}"
}
function check_internet_access() {
wget -q --spider https://google.com
if [ $? -ne 0 ]; then
error "No internet connection. Exiting..."
exit 1
fi
}
function check_new_ip() {
local new_ip
@ -37,6 +44,7 @@ function check_new_ip() {
fi
}
check_internet_access
check_new_ip
curl_answer="$(curl --request PATCH \