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 \