Last active
February 18, 2021 09:05
-
-
Save exalted/149cddbfef3c08c9cc5fd9c0e9cac6c5 to your computer and use it in GitHub Desktop.
Revisions
-
exalted revised this gist
Feb 18, 2021 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ # # USAGE: `healthcheck <name> <URL>` # # Minify using http://bash-minifier.appspot.com @@ -12,7 +12,7 @@ healthcheck() { while [[ true ]]; do started_at="$(date +"%Y-%m-%dT%H:%M:%SZ") (Local time)" SECONDS=0 output=$(curl --fail --silent --show-error --stderr - $2) result=$? if [[ $result -ne 0 ]]; then @@ -26,8 +26,9 @@ healthcheck() { fi if [[ $result -eq 0 ]] && [[ $SECONDS -le 1 ]]; then echo "$started_at: $1: $output" else echo "Name : $1" echo "Started at : $started_at" echo "Took : $SECONDS seconds" echo "Output : $output" @@ -39,4 +40,4 @@ healthcheck() { sleep 1; fi done } -
exalted revised this gist
Jan 8, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ healthcheck() { YELLOW='\033[0;33m' RED='\033[0;31m' COLOR_RESET='\033[0m' while [[ true ]]; do started_at="$(date +"%Y-%m-%dT%H:%M:%SZ") (Local time)" SECONDS=0 -
exalted revised this gist
Jan 8, 2021 . 1 changed file with 17 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,24 +9,33 @@ healthcheck() { RED='\033[0;31m' COLOR_RESET='\033[0m' while [[ true ]]; do started_at="$(date +"%Y-%m-%dT%H:%M:%SZ") (Local time)" SECONDS=0 output=$(curl --fail --silent --show-error --stderr - $1) result=$? if [[ $result -ne 0 ]]; then echo -e $RED elif [[ $SECONDS -le 1 ]]; then echo -e $GREEN elif [[ $SECONDS -le 2 ]]; then echo -e $YELLOW else echo -e $RED fi if [[ $result -eq 0 ]] && [[ $SECONDS -le 1 ]]; then echo "$started_at: $output" else echo "Started at : $started_at" echo "Took : $SECONDS seconds" echo "Output : $output" fi echo -e $COLOR_RESET if [[ $SECONDS -eq 0 ]]; then sleep 1; fi done } -
exalted created this gist
Jan 8, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # # USAGE: `healthcheck <URL>` # # Minify using http://bash-minifier.appspot.com healthcheck() { GREEN='\033[0;32m' YELLOW='\033[0;33m' RED='\033[0;31m' COLOR_RESET='\033[0m' while [[ true ]]; do then="$(date +"%Y-%m-%dT%H:%M:%SZ") (Local time)" SECONDS=0 output=$(curl --silent $1) if [[ $SECONDS -le 1 ]]; then echo -e $GREEN echo "$then: $output" continue elif [[ $SECONDS -le 2 ]]; then echo -e $YELLOW else echo -e $RED fi echo "Started at : $then" echo "Took : $SECONDS seconds" echo "Output : $output" echo -e $COLOR_RESET done }