| 1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/bash
- DOMAINS=(
- "glamour.ovh"
- "expired.badssl.com"
- )
- NAMES=(
- "GLAM"
- "BAD"
- )
- check_domain() {
- local domain="$1"
- local name="$2"
- local url="https://${domain}"
- local status="FAIL"
-
- http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 --head "$url")
- curl_exit=$?
- if [ $curl_exit -eq 0 ] && [ "$http_code" -ge 200 ] && [ "$http_code" -lt 400 ]; then
- status="OK"
- else
- status="NOK:ALERT"
- fi
- echo "${name}: ${status}"
- }
- if [ "${#DOMAINS[@]}" -ne "${#NAMES[@]}" ]; then
- echo "Error: Domain and Name array lengths do not match."
- exit 1
- fi
- for i in "${!DOMAINS[@]}"; do
- check_domain "${DOMAINS[$i]}" "${NAMES[$i]}"
- done
|