From 4af84efed152fe5fa8dbfc2e09afee6d2a0eee72 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 6 Aug 2024 21:56:27 +0200 Subject: [PATCH 1/3] move to exec this change uses the s6 death tally logic to check if it's the first start of the service, if it's not it will delay the start of airspy_adsb in the usual case of a normal container startup, airspy_adsb is instantly started up with exec which frees some memory used by bash --- rootfs/etc/s6-overlay/scripts/airspy_adsb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/airspy_adsb b/rootfs/etc/s6-overlay/scripts/airspy_adsb index 30d15ff..ab2adcd 100755 --- a/rootfs/etc/s6-overlay/scripts/airspy_adsb +++ b/rootfs/etc/s6-overlay/scripts/airspy_adsb @@ -2,7 +2,6 @@ #shellcheck shell=bash disable=SC1091 source /scripts/common -trap 'pkill -P $$' SIGTERM SIGINT SIGHUP SIGQUIT s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) @@ -167,11 +166,11 @@ fi "${s6wrap[@]}" echo "Running: ${AIRSPY_ADSB_BIN} ${AIRSPY_ADSB_CMD[*]}" # Slow down restarts -sleep 10 & +# wait 30 seconds if this is not the first startup (this should only happen on crashes or a bad command line, thus this can be a long timeout) +if [[ $(s6-svdt /run/service/airspy_adsb | wc -l) != 0 ]]; then + "${s6wrap[@]}" echo "delaying restart by 30 seconds" + sleep 30 +fi #shellcheck disable=SC2016 -"${s6wrap[@]}" "${AIRSPY_ADSB_BIN}" "${AIRSPY_ADSB_CMD[@]}" & - -# trap will only work properly while the shell is running / waiting, not while another program is being foreground executed -# the first wait exits due to the signal which is trapped, the 2nd wait actually waits for collectd to exit -wait || wait || true +exec "${s6wrap[@]}" "${AIRSPY_ADSB_BIN}" "${AIRSPY_ADSB_CMD[@]}" From d23e6a2b791777642bdd0e2a23cd3eac0d58e615 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 6 Aug 2024 21:57:36 +0200 Subject: [PATCH 2/3] use stop_service from common scripts instead of exec sleep inf --- rootfs/etc/s6-overlay/scripts/airspy_adsb | 6 +++--- rootfs/etc/s6-overlay/scripts/nginx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/airspy_adsb b/rootfs/etc/s6-overlay/scripts/airspy_adsb index ab2adcd..1333114 100755 --- a/rootfs/etc/s6-overlay/scripts/airspy_adsb +++ b/rootfs/etc/s6-overlay/scripts/airspy_adsb @@ -142,7 +142,7 @@ if [[ -z "$AIRSPY_ADSB_ARCH" ]]; then else "${s6wrap[@]}" echo "ERROR: Unsupported architecture: $(uname -m)!" - exec sleep infinity + stop_service fi fi @@ -152,13 +152,13 @@ AIRSPY_ADSB_BIN="/usr/local/bin/airspy_adsb.${AIRSPY_ADSB_ARCH}" # Ensure binary exists if [[ ! -x "$AIRSPY_ADSB_BIN" ]]; then "${s6wrap[@]}" echo "ERROR: Executable binary not found for architecture: $AIRSPY_ADSB_ARCH!" - exec sleep infinity + stop_service fi # Ensure binary runnable if ! "$AIRSPY_ADSB_BIN" -h > /dev/null 2>&1; then "${s6wrap[@]}" echo "ERROR: Executable $AIRSPY_ADSB_ARCH binary not supported on $(uname -m) architecture!" - exec sleep infinity + stop_service fi # Execute binary with arguments prepared above diff --git a/rootfs/etc/s6-overlay/scripts/nginx b/rootfs/etc/s6-overlay/scripts/nginx index bcfbac3..b152613 100755 --- a/rootfs/etc/s6-overlay/scripts/nginx +++ b/rootfs/etc/s6-overlay/scripts/nginx @@ -4,7 +4,7 @@ source /scripts/common if ! chk_enabled "${AIRSPY_ADSB_STATS}"; then - exec sleep infinity + stop_service fi exec s6wrap --quiet --prepend=nginx --timestamps --args /usr/sbin/nginx From 9907dfa3929bc6744fd78b73ff7d70125a1191a6 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Tue, 6 Aug 2024 23:40:51 +0200 Subject: [PATCH 3/3] airspy_adsb binary for arm64: use newer compile newer compile only available for arm64 slight CPU use reduction --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9970451..0e16a85 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ RUN set -x && \ curl \ --location \ --output /tmp/airspy_adsb-linux-arm64.tgz \ - "https://github.com/wiedehopf/airspy-conf/raw/master/buster/airspy_adsb-linux-arm64.tgz" \ + "https://github.com/wiedehopf/airspy-conf/raw/master/bookworm/airspy_adsb-linux-arm64.tgz" \ && \ tar \ xvf /tmp/airspy_adsb-linux-arm64.tgz \