Curl bash script
Jump to navigation
Jump to search
Test return code
#!/bin/bash set -eu mcode=200 url="https://example.com" while true; do ts=$(date "+%Y%m%dT%H%M%S") rcode=$(curl -X GET -sI "$url" | awk '/^HTTP/{print $2}') if [ "$rcode" != "$mcode" ]; then echo "ERROR: Invalid code. Was $rcode expected $mcode. TS: $ts" fi sleep 5 done