#!/bin/sh
# Root-owned, no arguments; restart only the independent catalog unit. Install/build is unprivileged.
set -eu
[ "$#" -eq 0 ] || exit 64
/usr/bin/systemctl restart battlelab-catalog.service
for attempt in 1 2 3 4 5 6 7 8 9 10; do
    if /usr/bin/curl --noproxy '*' --fail --silent --max-time 3 http://192.168.15.152:4302/healthz; then
        exit 0
    fi
    /usr/bin/sleep 2
done
exit 1
