From afcf62c4d9fdb998e5a6562a47c46dce7aaff45b Mon Sep 17 00:00:00 2001 From: AustrianToast Date: Tue, 22 Apr 2025 00:10:00 +0200 Subject: [PATCH] use new internet connectivity test --- add_and_download_url.sh | 11 ++++------- download_website.sh | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/add_and_download_url.sh b/add_and_download_url.sh index f7c5729..04a656b 100755 --- a/add_and_download_url.sh +++ b/add_and_download_url.sh @@ -37,13 +37,10 @@ for ((n=0;n<5;n++)); do fi echo -e "${IYELLOW}download failed${NO_COLOR}" - if ! ping -qc 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - elif ! ping -qc 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - else + if has_internet; then echo -e "${IGREEN}has internet${NO_COLOR}" + else + echo -e "${IYELLOW}no internet${NO_COLOR}" + exit 1 fi done diff --git a/download_website.sh b/download_website.sh index 37d733f..ff96f3a 100755 --- a/download_website.sh +++ b/download_website.sh @@ -26,14 +26,11 @@ download() { fi echo -e "${IYELLOW}download failed${NO_COLOR}" - if ! ping -qc 3 v4.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - elif ! ping -qc 3 v6.ip.hopeless-cloud.xyz > /dev/null 2>&1; then - echo -e "${IYELLOW}no internet${NO_COLOR}" - exit 1 - else + if has_internet; then echo -e "${IGREEN}has internet${NO_COLOR}" + else + echo -e "${IYELLOW}no internet${NO_COLOR}" + exit 1 fi done