diff --git a/scripts/pp-test.sh b/scripts/pp-test.sh index a7a12fd..4a05512 100755 --- a/scripts/pp-test.sh +++ b/scripts/pp-test.sh @@ -39,8 +39,8 @@ fi log() { echo "[pp-test] $*"; } die() { echo "[pp-test] FAIL: $*" >&2; exit 1; } -ssh_claw() { ssh -o BatchMode=yes "$CLAW" "$@"; } -ssh_server() { ssh -o BatchMode=yes "$SERVER" "$@"; } +ssh_claw() { ssh -o BatchMode=yes -o ConnectTimeout=8 "$CLAW" "$@"; } +ssh_server() { ssh -o BatchMode=yes -o ConnectTimeout=8 "$SERVER" "$@"; } # --------------------------------------------------------------------------- # preflight @@ -158,6 +158,9 @@ do_stop_pp() { } do_restore() { + # Warm-cache loads crash fast on the claw (AGENTS.md); cold loads survive. + log "dropping page caches on claw before production load" + ssh_claw "$SUDO sh -c 'sync; echo 3 > /proc/sys/vm/drop_caches'" || log "WARN: cache drop failed" log "starting production services" ssh_server "$SUDO systemctl start frank-default-small" || die "could not start frank-default-small" ssh_claw "$SUDO systemctl start frank-default-large" || die "could not start frank-default-large" @@ -185,11 +188,14 @@ case "${1:-}" in stop-pp) do_stop_pp ;; restore) do_restore ;; all) + log "full run: any failure auto-restores production services" do_preflight + trap 'do_restore || true' EXIT do_start do_verify do_bench do_restore + trap - EXIT ;; *) echo "Usage: $0 {preflight|start|verify|bench [prompt_k] [out] [reps]|stop-pp|restore|all}"