Skip to content

Commit

Permalink
use stop_service in place of exec sleep infinity for disabled services (
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedehopf authored Aug 6, 2024
1 parent 8c4e795 commit 6700e8c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/autogain
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/cleanup_globe_history
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/collectd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mkdir -p /run/collectd


if chk_enabled "${GRAPHS1090_DISABLE}" || chk_enabled "${TAR1090_DISABLE}"; then
exec sleep infinity
stop_service
fi


Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/graphs1090
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/graphs1090-writeback
Original file line number Diff line number Diff line change
Expand Up @@ -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 $!
Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/nginx
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/tar1090
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source /scripts/common

if chk_enabled "${TAR1090_DISABLE}"; then
exec sleep infinity
stop_service
fi

mkdir -p /run/tar1090
Expand Down
4 changes: 2 additions & 2 deletions rootfs/etc/s6-overlay/scripts/telegraf
Original file line number Diff line number Diff line change
Expand Up @@ -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 $!
Expand All @@ -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
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/timelapse1090
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ if chk_enabled "$ENABLE_TIMELAPSE1090" && ! chk_enabled "${TAR1090_DISABLE}"; th

sleep 30 & wait $!
else
exec sleep infinity
stop_service
fi

0 comments on commit 6700e8c

Please sign in to comment.