Curl one-liner to repeatedly check a specific url

3 months ago 4

Simple one-liner curl command for macOS/Unix bash terminal to repeatedly check a specific url

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

# Remark: list of valid timezones: wikipedia.org/wiki/List_of_tz_database_time_zones
clear; while [ : ]; do curl -sSL -w '%{http_code} %{url_effective} ' "https://github.com" -o /dev/null; echo $(TZ=":Europe/Zurich" date); sleep 5; done

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

# The following variation adds a dynamic cache busting query parameter to every request
clear; while [ : ]; do curl -sSL -w '%{http_code} %{url_effective} ' "https://github.com/?nocache=$(od -An -N2 -i /dev/random | tr -d ' ')" -o /dev/null; echo $(TZ=":Europe/Zurich" date); sleep 1; done
Read Entire Article