#!/bin/bash # Function to check a single webpage check_webpage() { local url=$1 local base_url=${2:-"http://localhost:8080"} local full_url="${base_url}${url}" local timeout=10 echo -n "Testing $full_url ... " # Use curl to fetch the page with timeout response=$(curl -s -w "\n%{http_code}" --max-time $timeout "$full_url") if [ $? -ne 0 ]; then echo "FAILED - Connection error or timeout" return 1 fi # Split response into body and status code HTTP_STATUS=$(echo "$response" | tail -n1) BODY=$(echo "$response" | sed '$d') # Check HTTP status if [ "$HTTP_STATUS" != "200" ]; then echo "FAILED - HTTP Status: $HTTP_STATUS" return 1 fi # Check if response contains HTML if ! echo "$BODY" | grep -q "\|