#!/bin/bash
port=8800

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

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