#!/bin/bash
port=8804

run_loc_fault_injection() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //localization/monitor_analysis/dashboard:main_dashboard -- --server.port $port
}

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