From 8af1ec1e332b5f5b6f27d7f1ddae0e1ae254baff Mon Sep 17 00:00:00 2001 From: kx1t Date: Fri, 13 Oct 2023 08:37:54 -0400 Subject: [PATCH] update --- rootfs/etc/s6-overlay/scripts/adsbx-stats | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/adsbx-stats b/rootfs/etc/s6-overlay/scripts/adsbx-stats index 489899f..3378afc 100755 --- a/rootfs/etc/s6-overlay/scripts/adsbx-stats +++ b/rootfs/etc/s6-overlay/scripts/adsbx-stats @@ -15,7 +15,7 @@ ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG#"${ULTRAFEEDER_CONFIG%%[![:space:]]*}"} ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG//; /;}" if ! grep -i adsbexchange.com <<< "$ULTRAFEEDER_CONFIG" >/dev/null 2>&1; then "${s6wrap[@]}" echo "AdsbExchange not configured - no stats package needed" - exec sleep infinity + sleep infinity & wait $! fi # Install the Stats package: @@ -27,10 +27,26 @@ fi if [[ ! -f /usr/local/bin/json-status ]]; then if ! curl -sSL -o /usr/local/bin/json-status https://raw.githubusercontent.com/ADSBexchange/adsbexchange-stats/master/json-status; then "${s6wrap[@]}" echo "ERROR: AdsbExchange configure, but cannot download stats package! AdsbExchange will be fed but stats will not be available" - exec sleep infinity + sleep infinity & wait $! fi chmod 755 /usr/local/bin/json-status fi mkdir -p /run/adsbexchange-stats + +# wait until readsb is established... +if ! pgrep readsb >/dev/null; then + if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then + "${s6wrap[@]}" --args echo "Delaying start of the AdsbExchange Stats module until container is established..." + fi + while ! pgrep readsb >/dev/null + do + sleep 2 & wait $! + done + # wait 2 seconds after readsb process exists + sleep 2 & wait $! +fi + +"${s6wrap[@]}" --args echo "invoking: /usr/local/bin/json-status" + "${s6wrap[@]}" /usr/local/bin/json-status \ No newline at end of file