#!/bin/bash
port=8808

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

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