Skip to content

Instantly share code, notes, and snippets.

@zhiguangwang
Last active May 5, 2019 10:01
Show Gist options
  • Save zhiguangwang/2d9299bea4da2fa36b8983cc4df19fe7 to your computer and use it in GitHub Desktop.
Save zhiguangwang/2d9299bea4da2fa36b8983cc4df19fe7 to your computer and use it in GitHub Desktop.
bash curl loop
curl-loop() { while true; do echo "$(date +%Y-%m-%dT%H:%M:%S%z) $(curl --silent --show-error ${1})"; sleep ${2:-0.5}; done }

Usage

curl-loop <url> [interval]

Example

Run every 0.5s (default)

curl-loop http://localhost:8080

Run every 1s

curl-loop http://localhost:8080 1

Run every 200ms

curl-loop http://localhost:8080 0.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment