#!/bin/bash
port=8801

run_pcp_err_viz() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //zsaf/server/pcp_err_analysis:pcp_err_analysis -- --server.port $port
}

until run_pcp_err_viz; do
    echo "Service crashed with exit code $?. Restarting in 5 seconds..." >&2
    sleep 5
done
