diff --git a/http_check_telegram b/http_check_telegram index e7c79f0..e5c803e 100755 --- a/http_check_telegram +++ b/http_check_telegram @@ -58,7 +58,7 @@ MSG='HTTP/S Problems Found:' FAILURE=false # Check HTTP codes -for site in $(< $CHKLIST); do +for site in $(grep -v "^#\|^$" $CHKLIST); do respcode=$(get_http_code $site) case $respcode in 000) @@ -81,7 +81,9 @@ for site in $(< $CHKLIST); do done || exit 2 # Send compiled message if any problems were found -send_message "$MSG" && printf '%s\n' "Problems found. Message sent via Telegram bot" >&2 || printf '%s\n' "Problems found. Message sending has failed" +if [ "$FAILURE" = "true" ]; then + send_message "$MSG" && printf '%s\n' "Problems found. Message sent via Telegram bot" >&2 || printf '%s\n' "Problems found. Message sending has failed" +fi exit 0