uce/scripts/systemd/wait-ready.sh
2026-07-17 02:09:16 +00:00

21 lines
541 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
socket_path="/run/uce/cli.sock"
if [[ -r /etc/uce/settings.cfg ]]; then
configured_socket=$(awk -F= '/^[[:space:]]*CLI_SOCKET_PATH[[:space:]]*=/ {gsub(/^[[:space:]]+|[[:space:]]+$/, "", $2); print $2; exit}' /etc/uce/settings.cfg)
if [[ -n "${configured_socket:-}" ]]; then
socket_path="$configured_socket"
fi
fi
for ((attempt = 0; attempt < 200; attempt++)); do
if [[ -S "$socket_path" ]]; then
exit 0
fi
sleep 0.05
done
echo "UCE CLI socket did not become ready: $socket_path" >&2
exit 1