#!/bin/bash # Valida una muestra aleatoria del inventario contra el Joomla local y mide tiempos set -uo pipefail BASE=/home/rafa/joomla-migration/mirror-antiguo INV=$BASE/inventory N=${1:-40} H='Host: antiguo.feadulta.com' tmp=$(mktemp) shuf -n "$N" "$INV/urls-input.txt" > "$tmp" ok=0; bad=0; tot=0 start=$(date +%s.%N) while read -r u; do path=${u#http://antiguo.feadulta.com} read -r code t size < <(curl -s -o /dev/null -w '%{http_code} %{time_total} %{size_download}' -H "$H" "http://127.0.0.1:8086$path"; echo) tot=$(echo "$tot + $t" | bc) if [ "$code" = "200" ]; then ok=$((ok+1)); else bad=$((bad+1)); printf 'FALLO %s %s %s\n' "$code" "$t" "$path"; fi done < "$tmp" end=$(date +%s.%N) echo "---" echo "muestra=$N 200=$ok no200=$bad" echo "tiempo medio por peticion: $(echo "scale=3; $tot / $N" | bc) s" echo "wall: $(echo "scale=1; $end - $start" | bc) s" echo "estimacion 25437 URLs a 1 hilo: $(echo "scale=1; $tot / $N * 25437 / 3600" | bc) h" rm -f "$tmp"