From 712b7948301b7d075fdd57ad46cb1c53cdf0e8f2 Mon Sep 17 00:00:00 2001 From: Leonard Excoffier <48970393+excoffierleonard@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:17:15 -0400 Subject: [PATCH] refactor: removed redundant variable naming. --- isalive.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/isalive.sh b/isalive.sh index 352803a..a52c87a 100644 --- a/isalive.sh +++ b/isalive.sh @@ -1,26 +1,19 @@ #!/bin/bash -# List of websites to monitor -websites=$WEBSITES - -# Discord Webhook URL -webhook_url=$WEBHOOK_URL - # Function to send a message to Discord webhook send_discord_notification() { local message=$1 curl -H "Content-Type: application/json" \ -X POST \ -d "{\"content\": \"$message\"}" \ - "$webhook_url" + "$WEBHOOK_URL" } # Loop through the websites and check their status -for website in "${websites[@]}"; do +for website in "${$WEBSITES[@]}"; do response=$(curl -s -o /dev/null -L -w "%{http_code}" --max-time 10 --connect-timeout 5 --insecure "$website") if [ "$response" != "200" ]; then send_discord_notification "$DISCORD_ID Alert: Website $website is down (HTTP $response)" fi done -