diff options
author | Ben Sima <ben@bsima.me> | 2022-07-18 09:46:20 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2022-07-18 09:46:37 -0400 |
commit | 545ec609e38517ce6bf68e47a48991ede15f61a4 (patch) | |
tree | 36fb41d5a62664202e713f2625d5ea6868ef58b9 | |
parent | 86f9e46424d3c07f211fae332b93b8995ae1c91b (diff) |
Move sentry function to Sentry.sh
-rw-r--r-- | Biz/Bild/ShellHook.sh | 45 | ||||
-rw-r--r-- | Biz/Sentry.sh | 40 |
2 files changed, 40 insertions, 45 deletions
diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh index c385016..4ab1920 100644 --- a/Biz/Bild/ShellHook.sh +++ b/Biz/Bild/ShellHook.sh @@ -14,12 +14,6 @@ echo " ship lint, bild, and push one (or all) namespace(s)" } # -# 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 -# alias runghc="runghc --ghc-arg=-i\$BIZ_ROOT" alias guile="guile -L \$BIZ_ROOT" alias tree="tree -I _ -F" @@ -30,45 +24,6 @@ niv --sources-file "$BIZ_ROOT/Biz/Bild/Sources.json" "$@" } # - function pie() { - runghc Biz.Pie "$@" - } -# - function run-sentry() { - 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 - } -# - function sentry() { - while true - do - clear - printf "%s sentry\n\n" "$(date +%Y.%m.%d..%H.%M)" - run-sentry - sleep 120 - done - } -# # Poor man's ci alias ci="$BIZ_ROOT/Biz/Ide/hooks/pre-push" # 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 +## |