Created
August 25, 2021 10:29
-
-
Save gerardolima/7d164c8b5d2cfded626090fd1e77c104 to your computer and use it in GitHub Desktop.
Repeatedly calls URL and waits WAIT seconds
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
| #! /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