From c609c909c55f5cbc4981b9e5ff9a14c8d6f4bdcb Mon Sep 17 00:00:00 2001 From: kx1t <15090643+kx1t@users.noreply.github.com> Date: Thu, 23 Mar 2023 12:13:55 +0100 Subject: [PATCH] Add startup delay to allow mlat_client to start before mlathub --- rootfs/etc/services.d/mlathub/run | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rootfs/etc/services.d/mlathub/run b/rootfs/etc/services.d/mlathub/run index 24b1c61..a90b6bc 100644 --- a/rootfs/etc/services.d/mlathub/run +++ b/rootfs/etc/services.d/mlathub/run @@ -97,6 +97,15 @@ if [[ -n "$READSB_NET_HEARTBEAT" ]]; then MLATHUB_CMD+=("--net-heartbeat=$READSB_NET_HEARTBEAT") fi +if (( $(ps -o etimes= -p 1) < 30 )) +then + echo "[$(date)][mlathub] Delaying MLAT hub start until container is established..." + while (( $(ps -o etimes= -p 1) < 30 )) + do + sleep 5 + done +fi + echo "[$(date)][mlathub] Starting MLATHUB with this command line: ${MLATHUB_BIN} ${MLATHUB_CMD[*]} $MLATHUB_EXTRA_ARGS" # shellcheck disable=SC2086