#!/bin/bash
port=8811

run_zsaf_db_browser() {
    fuser -k $port/tcp
    bazel run --config=cuda -c opt //zsaf/bayesian_optimization/tools:database_browser -- --server.port $port
}

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