From b2284316a97522a287a46d1d8e8d32503f8dfb7a Mon Sep 17 00:00:00 2001 From: Leonard Excoffier <48970393+excoffierleonard@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:53:34 -0400 Subject: [PATCH] fix: fixed the problem of separating website --- DOCKERFILE | 2 +- isalive.sh | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DOCKERFILE b/DOCKERFILE index d445521..2340cb8 100644 --- a/DOCKERFILE +++ b/DOCKERFILE @@ -2,7 +2,7 @@ FROM debian # Set required environment variables -ENV WEBSITES='("google.com" "yahoo.com")' +ENV WEBSITES="google.com,yahoo.com" ENV WEBHOOK_URL="" ENV DISCORD_ID="" diff --git a/isalive.sh b/isalive.sh index a52c87a..709d790 100644 --- a/isalive.sh +++ b/isalive.sh @@ -9,8 +9,11 @@ send_discord_notification() { "$WEBHOOK_URL" } +# Split the comma-separated string of websites into a proper list +IFS=',' read -ra website_array <<< "$WEBSITES" + # Loop through the websites and check their status -for website in "${$WEBSITES[@]}"; do +for website in "${website_array[@]}"; do response=$(curl -s -o /dev/null -L -w "%{http_code}" --max-time 10 --connect-timeout 5 --insecure "$website") if [ "$response" != "200" ]; then