diff --git a/rootfs/etc/services.d/mlat-client/run b/rootfs/etc/services.d/mlat-client/run index 7643d37..2737ed8 100644 --- a/rootfs/etc/services.d/mlat-client/run +++ b/rootfs/etc/services.d/mlat-client/run @@ -90,6 +90,16 @@ do # shellcheck disable=SC2048,SC2086 execstring="$(echo ${MLAT_CMD} ${MLAT_PARAM[*]} | xargs)" + # Wait a bit until readsb is established... + if ! pgrep readsb >/dev/null +then + echo "[$(date)][mlathub] Delaying start of MLAT client(s) until container is established..." + while ! pgrep readsb >/dev/null + sleep 2 + done +fi +sleep 10 # sleep a bit so everything is well established - starting readsb may take a bit + # run this Mlat_client instance in the background: echo "[$(date)][${APPNAME}] starting: ${MLAT_CMD} ${MLAT_PARAM[*]}" diff --git a/rootfs/etc/services.d/mlathub/run b/rootfs/etc/services.d/mlathub/run index fce52d9..d4e6a97 100644 --- a/rootfs/etc/services.d/mlathub/run +++ b/rootfs/etc/services.d/mlathub/run @@ -99,15 +99,15 @@ fi # Handle "--net-heartbeat=" MLATHUB_CMD+=("--net-heartbeat=${READSB_NET_HEARTBEAT:-30}") -if ! pgrep readsb >/dev/null 2>&1 +if ! pgrep readsb >/dev/null || ! pgrep 'mlat-client' >/dev/null then echo "[$(date)][mlathub] Delaying MLAT hub start until container is established..." - while ! pgrep readsb >/dev/null 2>&1 + while ! pgrep readsb >/dev/null || ! pgrep 'mlat-client' >/dev/null do sleep 2 done fi -sleep 5 # sleep a bit so readsb is well established +sleep 5 # sleep a bit so everything is well established echo "[$(date)][mlathub] Starting MLATHUB..." @@ -122,3 +122,5 @@ elif [[ "${LOGLEVEL,,}" == "none" ]]; then "${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS >/dev/null 2>/dev/null fi +echo "[$(date +%Y-%m-%d %H:%M:%S)][mlathub] The mlathub instance has exited. Restarting in 10 seconds." +sleep 10 \ No newline at end of file diff --git a/rootfs/etc/services.d/readsb/run b/rootfs/etc/services.d/readsb/run index 95661ba..b42c15b 100644 --- a/rootfs/etc/services.d/readsb/run +++ b/rootfs/etc/services.d/readsb/run @@ -1,8 +1,6 @@ #!/usr/bin/with-contenv bash # shellcheck shell=bash disable=SC2016 -#all-in-one - mkdir -p /run/readsb # Build the readsb command line based on options @@ -322,6 +320,7 @@ elif [[ "${LOGLEVEL,,}" == "none" ]]; then "${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS >/dev/null 2>/dev/null fi - +echo "[$(date +%Y-%m-%d %H:%M:%S)][readsb] The main readsb instance has exited. Restarting in 10 seconds." +sleep 10