Skip to content

Instantly share code, notes, and snippets.

@manhdaovan
Last active October 5, 2021 07:04
Show Gist options
  • Save manhdaovan/41a8fcb0fb1eab5930725df18185d16f to your computer and use it in GitHub Desktop.
Save manhdaovan/41a8fcb0fb1eab5930725df18185d16f to your computer and use it in GitHub Desktop.
Simple tool to check probation of given URL using cURL with HTTP GET method.
#!/bin/bash
# Simple tool to check probation of given URL
# using cURL with HTTP GET method.
url=$1
TXT_RED='\033[0;31m'
TXT_GREEN='\033[0;32m'
# check until pressing Ctr+C
echo "[$(date +%s)] Start checking probation for url: $url"
while true; do
if ! curl --max-time 1 --output /dev/null --silent --fail $url &> /dev/null
then
printf "${TXT_RED}[$(date +%s)] F\n"
else
printf "${TXT_GREEN}[$(date +%s)] .\n"
fi
sleep 1
done
# check until response success
# echo "[$(date +%s)] Start checking probation for url: $url"
# until $(curl --max-time 1 --output /dev/null --silent --fail $url); do
# printf '.'
# sleep 1
# done
# echo ""
# echo "[$(date +%s)] Finish checking probation for url: $url"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment