From 7fb2355b1adad5137600d4b60d5e8ae2a151a395 Mon Sep 17 00:00:00 2001 From: Vasily Davydov Date: Sat, 8 Jun 2024 13:30:50 +0300 Subject: [PATCH] cloudflare_dns: fix #1 --- services/cloudflare_update_dns | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/cloudflare_update_dns b/services/cloudflare_update_dns index f3139bd..bca7c94 100755 --- a/services/cloudflare_update_dns +++ b/services/cloudflare_update_dns @@ -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 \