From 545ec609e38517ce6bf68e47a48991ede15f61a4 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 18 Jul 2022 09:46:20 -0400 Subject: Move sentry function to Sentry.sh --- Biz/Sentry.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Biz/Sentry.sh (limited to 'Biz/Sentry.sh') diff --git a/Biz/Sentry.sh b/Biz/Sentry.sh new file mode 100644 index 0000000..5c9e0ac --- /dev/null +++ b/Biz/Sentry.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# monitors our infrastructure +# +# +# color codes for use with printf + export RED='\033[0;31m' + export GRN='\033[0;32m' + export YEL='\033[0;33m' + export NC='\033[0m' # No Color +# + while true + do + clear + printf "%s sentry\n\n" "$(date +%Y.%m.%d..%H.%M)" + urls=( + http://que.run + https://dragons.dev + https://simatime.com + https://tv.simatime.com + https://bsima.me + # https://herocomics.app + ) + for url in "${urls[@]}" + do + code=$(curl -L --max-time 10 --silent --show-error --insecure \ + --output /dev/null \ + --write-out "%{http_code}" "$url") + case "$code" in + 2[0-9][0-9]) color=${GRN};; + 3[0-9][0-9]) color=${YEL};; + 4[0-9][0-9]) color=${YEL};; + 5[0-9][0-9]) color=${RED};; + *) color=${RED};; + esac + printf "%b%s %s%b\n" "$color" "$code" "$url" "$NC" + done + sleep 120 + done +## -- cgit v1.2.3