Created
March 7, 2024 16:54
-
-
Save GammaGames/0655945874a6df3450806ef93ead9886 to your computer and use it in GitHub Desktop.
purl - curl endpoint and print non-200 statuses (ping + curl)
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 characters
#!/usr/bin/env bash | |
_val=`curl -Isk $2 | grep HTTP | cut -d ' ' -f2` | |
echo "$(date) $_val" | |
_diff=0 | |
while : | |
do | |
_val2=`curl -Isk $2 | grep HTTP | cut -d ' ' -f2` | |
if [ "$_val" != "$_val2" ]; then | |
echo "$(date) $_val2" | |
_diff=1 | |
else if [ $_diff -eq 1 ]; then | |
echo "$(date) $_val2" | |
_diff=0 | |
fi | |
fi | |
sleep $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
./purl.sh 1 https://www.google.com/
Sample output: