Skip to content

Instantly share code, notes, and snippets.

@gerardolima
Created August 25, 2021 10:29
Show Gist options
  • Select an option

  • Save gerardolima/7d164c8b5d2cfded626090fd1e77c104 to your computer and use it in GitHub Desktop.

Select an option

Save gerardolima/7d164c8b5d2cfded626090fd1e77c104 to your computer and use it in GitHub Desktop.
Repeatedly calls URL and waits WAIT seconds
#! /bin/bash
URL=$1
WAIT=${2:-60}
if [[ $URL != http* ]] ;
then
echo 'Repeatedly calls URL and waits WAIT seconds (default = 60)'
echo 'usage example:'
echo '$ ./ping-url.sh https://google.com 2'
exit
fi
until false
do
printf $(date -ju +"%Y-%m-%dT%H:%M:%SZ")
curl --silent --show-error --output /dev/null --write-out " (%{http_code}) %{url_effective}\n" $URL
sleep $WAIT
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment