From 6700e8ccd190eb75fba12e58db6a7c367865e7d8 Mon Sep 17 00:00:00 2001 From: wiedehopf Date: Tue, 6 Aug 2024 22:26:27 +0200 Subject: [PATCH] use stop_service in place of exec sleep infinity for disabled services (#218) --- rootfs/etc/s6-overlay/scripts/autogain | 4 ++-- rootfs/etc/s6-overlay/scripts/cleanup_globe_history | 2 +- rootfs/etc/s6-overlay/scripts/collectd | 4 ++-- rootfs/etc/s6-overlay/scripts/graphs1090 | 2 +- rootfs/etc/s6-overlay/scripts/graphs1090-writeback | 2 +- rootfs/etc/s6-overlay/scripts/nginx | 2 +- rootfs/etc/s6-overlay/scripts/tar1090 | 2 +- rootfs/etc/s6-overlay/scripts/telegraf | 4 ++-- rootfs/etc/s6-overlay/scripts/timelapse1090 | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/autogain b/rootfs/etc/s6-overlay/scripts/autogain index f40cd30..f59b9d5 100755 --- a/rootfs/etc/s6-overlay/scripts/autogain +++ b/rootfs/etc/s6-overlay/scripts/autogain @@ -19,12 +19,12 @@ READSB_AUTOGAIN_INITIAL_TIMEPERIOD="${READSB_AUTOGAIN_INITIAL_TIMEPERIOD:-7200}" if [[ "${READSB_GAIN,,}" != "autogain" ]]; then # Autogain is not enabled, so let's do nothing forever - exec sleep infinity + stop_service fi if [[ "${READSB_DEVICE_TYPE,,}" != "rtlsdr" ]]; then s6wrap --quiet --prepend=autogain --timestamps --args echo "ERROR: AUTOGAIN enabled but READSB_DEVICE_TYPE is not \"rtlsdr\". Autogain disabled." - exec sleep infinity + stop_service fi mkdir -p /var/globe_history/autogain diff --git a/rootfs/etc/s6-overlay/scripts/cleanup_globe_history b/rootfs/etc/s6-overlay/scripts/cleanup_globe_history index 3a5b4cf..5496f86 100755 --- a/rootfs/etc/s6-overlay/scripts/cleanup_globe_history +++ b/rootfs/etc/s6-overlay/scripts/cleanup_globe_history @@ -25,7 +25,7 @@ source /scripts/common if [[ -z "$MAX_GLOBE_HISTORY" ]]; then "${s6wrap[@]}" echo "MAX_GLOBE_HISTORY not set - we will not expire any globe_history files" - exec sleep infinity + stop_service fi cutoffepoch="$(date -d"-${MAX_GLOBE_HISTORY} days" +%s)" diff --git a/rootfs/etc/s6-overlay/scripts/collectd b/rootfs/etc/s6-overlay/scripts/collectd index 966015b..d3b1efb 100755 --- a/rootfs/etc/s6-overlay/scripts/collectd +++ b/rootfs/etc/s6-overlay/scripts/collectd @@ -8,7 +8,7 @@ mkdir -p /run/collectd if chk_enabled "${GRAPHS1090_DISABLE}" || chk_enabled "${TAR1090_DISABLE}"; then - exec sleep infinity + stop_service fi @@ -17,7 +17,7 @@ if chk_enabled "${GRAPHS1090_REDUCE_IO}"; then # readback rrd database from compressed archive if ! s6wrap --quiet --prepend=graphs1090-readback --timestamps --args bash /usr/share/graphs1090/readback.sh; then s6wrap --quiet --prepend=graphs1090-readback --timestamps --args echo "FATAL: readback returned an error" - exec sleep infinity + stop_service fi elif [[ -f "${PERMFILE}" ]] && ! [[ -d /var/lib/collectd/rrd/localhost ]]; then # extract rrd database from compressed archive (in case WAS enabled) diff --git a/rootfs/etc/s6-overlay/scripts/graphs1090 b/rootfs/etc/s6-overlay/scripts/graphs1090 index 9163bfd..133632d 100755 --- a/rootfs/etc/s6-overlay/scripts/graphs1090 +++ b/rootfs/etc/s6-overlay/scripts/graphs1090 @@ -5,7 +5,7 @@ source /scripts/common if chk_enabled "${GRAPHS1090_DISABLE}" || chk_enabled "${TAR1090_DISABLE}"; then - exec sleep infinity + stop_service fi mkdir -p /run/graphs1090 diff --git a/rootfs/etc/s6-overlay/scripts/graphs1090-writeback b/rootfs/etc/s6-overlay/scripts/graphs1090-writeback index f8a588d..b6ed529 100755 --- a/rootfs/etc/s6-overlay/scripts/graphs1090-writeback +++ b/rootfs/etc/s6-overlay/scripts/graphs1090-writeback @@ -6,7 +6,7 @@ source /scripts/common trap 'pkill -P $$ || true; exit 0' SIGTERM SIGINT SIGHUP SIGQUIT if chk_enabled "${GRAPHS1090_DISABLE}" || ! chk_enabled "${GRAPHS1090_REDUCE_IO}" || chk_enabled "${TAR1090_DISABLE}"; then - exec sleep infinity + stop_service fi sleep "${GRAPHS1090_REDUCE_IO_FLUSH_IVAL:-1d}" & wait $! diff --git a/rootfs/etc/s6-overlay/scripts/nginx b/rootfs/etc/s6-overlay/scripts/nginx index 8016ec6..8ae32ac 100755 --- a/rootfs/etc/s6-overlay/scripts/nginx +++ b/rootfs/etc/s6-overlay/scripts/nginx @@ -4,7 +4,7 @@ source /scripts/common if [[ "$(find /etc/nginx/sites-enabled/ -type f | wc -l)" == "0" ]]; then - exec sleep infinity + stop_service fi diff --git a/rootfs/etc/s6-overlay/scripts/tar1090 b/rootfs/etc/s6-overlay/scripts/tar1090 index 4da9f07..8fca336 100755 --- a/rootfs/etc/s6-overlay/scripts/tar1090 +++ b/rootfs/etc/s6-overlay/scripts/tar1090 @@ -4,7 +4,7 @@ source /scripts/common if chk_enabled "${TAR1090_DISABLE}"; then - exec sleep infinity + stop_service fi mkdir -p /run/tar1090 diff --git a/rootfs/etc/s6-overlay/scripts/telegraf b/rootfs/etc/s6-overlay/scripts/telegraf index 087aeb1..59e6c6d 100755 --- a/rootfs/etc/s6-overlay/scripts/telegraf +++ b/rootfs/etc/s6-overlay/scripts/telegraf @@ -9,7 +9,7 @@ trap 'pkill -P $$ || true; exit 0' SIGTERM SIGINT SIGHUP SIGQUIT if [[ -n "$INFLUXDBV2_URL" ]] || chk_enabled "${PROMETHEUS_ENABLE}"; then if [[ ! -f /usr/bin/telegraf ]]; then s6wrap --quiet --prepend=telegraf --timestamps --args echo "WARNING: InfluxDB/Prometheus parameters are set but Telegraf not included in this container" - exec sleep infinity + stop_service fi # give other services time to stabilise sleep 5 & wait $! @@ -24,5 +24,5 @@ if [[ -n "$INFLUXDBV2_URL" ]] || chk_enabled "${PROMETHEUS_ENABLE}"; then s6wrap --quiet --prepend=telegraf --timestamps --args telegraf --config-directory /etc/telegraf/telegraf.d | grep -v "error converting to float" else # if telegraf not needed, sleep forever - exec sleep infinity + stop_service fi diff --git a/rootfs/etc/s6-overlay/scripts/timelapse1090 b/rootfs/etc/s6-overlay/scripts/timelapse1090 index fd0bd64..8c93dad 100755 --- a/rootfs/etc/s6-overlay/scripts/timelapse1090 +++ b/rootfs/etc/s6-overlay/scripts/timelapse1090 @@ -28,5 +28,5 @@ if chk_enabled "$ENABLE_TIMELAPSE1090" && ! chk_enabled "${TAR1090_DISABLE}"; th sleep 30 & wait $! else - exec sleep infinity + stop_service fi