Added ability to comment out lines in site list; fixed message being sent even when there are no problems

master
Aaron Johnon 4 years ago
parent bfb91dee36
commit e8b9f0191a

@ -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

Loading…
Cancel
Save