diff --git a/rootfs/etc/s6-overlay/scripts/adsbx-stats b/rootfs/etc/s6-overlay/scripts/adsbx-stats index ac71ea4..be21583 100755 --- a/rootfs/etc/s6-overlay/scripts/adsbx-stats +++ b/rootfs/etc/s6-overlay/scripts/adsbx-stats @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash disable=SC2015,SC2016,SC1091,SC2001 +# shellcheck shell=bash disable=SC2015,SC2016,SC1091,SC2001,SC2154 #--------------------------------------------------------------------------------------------- # Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors @@ -19,7 +19,6 @@ source /scripts/common source /scripts/interpret_ultrafeeder_config -s6wrap=(s6wrap --quiet --timestamps --prepend="$(basename "$0")" --args) # Check if ADSBExchange is configured if ! grep -i adsbexchange.com <<< "$ULTRAFEEDER_CONFIG" >/dev/null 2>&1; then diff --git a/rootfs/etc/s6-overlay/scripts/mlat-client b/rootfs/etc/s6-overlay/scripts/mlat-client index 4e48a84..16ed88c 100755 --- a/rootfs/etc/s6-overlay/scripts/mlat-client +++ b/rootfs/etc/s6-overlay/scripts/mlat-client @@ -22,12 +22,20 @@ trap 'pkill -P "$$" || true; s6wrap --quiet --timestamps --prepend=mlat-client - source /scripts/common source /scripts/interpret_ultrafeeder_config -s6wrap=(s6wrap --quiet --timestamps --prepend="$(basename "$0")") +s6wrap=(s6wrap --quiet --timestamps --prepend="$SCRIPT_NAME") "${s6wrap[@]}" --args echo "Started as an s6 service" MLAT_CMD="/usr/bin/mlat-client" +LOGLEVEL="${LOGLEVEL,,}" +LOGLEVEL="${LOGLEVEL:-verbose}" +chk_disabled "$LOGLEVEL" && LOGLEVEL="none" || true +if ! [[ "$LOGLEVEL" =~ ^(verbose|error|none)$ ]]; then + [[ -n "$LOGLEVEL" ]] && "${s6wrap[@]}" --args echo "[WARNING] LOGLEVEL set to an unknown value. Defaulting to \"verbose\"" || true + LOGLEVEL="verbose" +fi + RESTARTTIMER=15 declare -A pid_array @@ -215,13 +223,14 @@ do # ------------------------------------------------ # run this Mlat_client instance in the background: + #shellcheck disable=SC2069,SC2086 - if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then - "${s6wrap[@]}" --prepend="$(basename "$0")][${servername}" --args echo "starting: ${MLAT_CMD} ${MLAT_PARAM[*]}" + if [[ "${LOGLEVEL}" == "verbose" ]]; then + "${s6wrap[@]}" --prepend="$(basename "$0")][${servername}" --args echo "starting: ${execstring}" "${s6wrap[@]}" --prepend="$(basename "$0")][${servername}" --args ${execstring} & - elif [[ "${LOGLEVEL,,}" == "error" ]]; then + elif [[ "${LOGLEVEL}" == "error" ]]; then "${s6wrap[@]}" --ignore=stdout --prepend="$(basename "$0")][${servername}" --args ${execstring} & - elif [[ "${LOGLEVEL,,}" == "none" ]]; then + elif [[ "${LOGLEVEL}" == "none" ]]; then "${s6wrap[@]}" --ignore=stderr --ignore=stdout --prepend="$(basename "$0")][${servername}" --args ${execstring} & fi @@ -249,11 +258,11 @@ do execstring="$(echo ${MLAT_CMD} ${pid_array[$mlat_pid]} | xargs)" #shellcheck disable=SC2069,SC2086 - if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then + if [[ "${LOGLEVEL}" == "verbose" ]]; then "${s6wrap[@]}" --prepend="$(basename "$0")][${servername}" --args ${execstring} & - elif [[ "${LOGLEVEL,,}" == "error" ]]; then + elif [[ "${LOGLEVEL}" == "error" ]]; then "${s6wrap[@]}" --ignore=stdout --prepend="$(basename "$0")][${servername}" --args ${execstring} & - elif [[ "${LOGLEVEL,,}" == "none" ]]; then + elif [[ "${LOGLEVEL}" == "none" ]]; then "${s6wrap[@]}" --ignore=stderr --ignore=stdout --prepend="$(basename "$0")][${servername}" --args ${execstring} & fi diff --git a/rootfs/etc/s6-overlay/scripts/mlathub b/rootfs/etc/s6-overlay/scripts/mlathub index 4182b88..5b36846 100755 --- a/rootfs/etc/s6-overlay/scripts/mlathub +++ b/rootfs/etc/s6-overlay/scripts/mlathub @@ -17,10 +17,17 @@ # If not, see . #--------------------------------------------------------------------------------------------- -APPNAME="mlathub" source /scripts/common source /scripts/interpret_ultrafeeder_config -s6wrap=(s6wrap --quiet --timestamps --prepend="${APPNAME}") +s6wrap=(s6wrap --quiet --timestamps --prepend="$SCRIPT_NAME") + +LOGLEVEL="${LOGLEVEL,,}" +LOGLEVEL="${LOGLEVEL:-verbose}" +chk_disabled "$LOGLEVEL" && LOGLEVEL="none" || true +if ! [[ "$LOGLEVEL" =~ ^(verbose|error|none)$ ]]; then + [[ -n "$LOGLEVEL" ]] && "${s6wrap[@]}" --args echo "[WARNING] LOGLEVEL set to an unknown value. Defaulting to \"verbose\"" || true + LOGLEVEL="verbose" +fi if [[ -z "${MLAT_CONFIG}" ]] && [[ -z "$MLATHUB_NET_CONNECTOR" ]]; then "${s6wrap[@]}" --args echo "No MLAT servers have been defined in MLAT_CONFIG and no external sources have been defined in MLATHUB_NET_CONNECTOR - no need to start MLATHUB" @@ -98,10 +105,10 @@ MLATHUB_CMD+=("--net-heartbeat=${READSB_NET_HEARTBEAT:-35}") "${s6wrap[@]}" --args echo "Starting MLATHUB..." # shellcheck disable=SC2086,SC2069 -if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then +if [[ "${LOGLEVEL}" == "verbose" ]]; then exec "${s6wrap[@]}" --args "${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS -elif [[ "${LOGLEVEL,,}" == "error" ]]; then +elif [[ "${LOGLEVEL}" == "error" ]]; then exec "${s6wrap[@]}" --ignore=stdout --args "${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS -elif [[ "${LOGLEVEL,,}" == "none" ]]; then +elif [[ "${LOGLEVEL}" == "none" ]]; then exec "${s6wrap[@]}" --ignore=stdtout --ignore=stderr --args "${MLATHUB_BIN}" "${MLATHUB_CMD[@]}" $MLATHUB_EXTRA_ARGS fi diff --git a/rootfs/etc/s6-overlay/scripts/readsb b/rootfs/etc/s6-overlay/scripts/readsb index f10636e..3a7871a 100755 --- a/rootfs/etc/s6-overlay/scripts/readsb +++ b/rootfs/etc/s6-overlay/scripts/readsb @@ -23,6 +23,14 @@ s6wrap=(s6wrap --quiet --timestamps --prepend="${SCRIPT_NAME}") mkdir -p /run/readsb +LOGLEVEL="${LOGLEVEL,,}" +LOGLEVEL="${LOGLEVEL:-verbose}" +chk_disabled "$LOGLEVEL" && LOGLEVEL="none" || true +if ! [[ "$LOGLEVEL" =~ ^(verbose|error|none)$ ]]; then + [[ -n "$LOGLEVEL" ]] && "${s6wrap[@]}" --args echo "[WARNING] LOGLEVEL set to an unknown value. Defaulting to \"verbose\"" || true + LOGLEVEL="verbose" +fi + # Build the readsb command line based on options READSB_BIN="/usr/local/bin/readsb" @@ -340,10 +348,6 @@ if chk_enabled "$PROMETHEUS_ENABLE"; then READSB_CMD+=("--write-prom=/run/readsb-prometheus.prom") fi -if ! [[ "${LOGLEVEL,,}" =~ ^(verbose|error|none)$ ]]; then - [[ -n "$LOGLEVEL" ]] && "${s6wrap[@]}" --args echo "[WARNING] LOGLEVEL set to an unknown value. Defaulting to \"verbose\"" || true - LOGLEVEL="verbose" -fi # shellcheck disable=SC2086 if [[ "${LOGLEVEL,,}" == "verbose" ]]; then exec "${s6wrap[@]}" --args "${READSB_BIN}" "${READSB_CMD[@]}" $READSB_EXTRA_ARGS diff --git a/rootfs/etc/s6-overlay/startup.d/01-print-container-version b/rootfs/etc/s6-overlay/startup.d/01-print-container-version index 87a9ffb..95753dd 100755 --- a/rootfs/etc/s6-overlay/startup.d/01-print-container-version +++ b/rootfs/etc/s6-overlay/startup.d/01-print-container-version @@ -1,5 +1,5 @@ #!/command/with-contenv bash -# shellcheck shell=bash disable=SC1091,SC2015 +# shellcheck shell=bash disable=SC1091,SC2015,SC2154 source /scripts/common @@ -20,4 +20,4 @@ source /scripts/common # If not, see . #--------------------------------------------------------------------------------------------- -[[ -f /.CONTAINER_VERSION ]] && echo "Container Version: $(cat /.CONTAINER_VERSION), build date $(stat -c '%y' /.CONTAINER_VERSION |sed 's|\(.*\)\.[0-9]* \(.*\)|\1 \2|g')" || true +[[ -f /.CONTAINER_VERSION ]] && "${s6wrap[@]}" echo "Container Version: $(cat /.CONTAINER_VERSION), build date $(stat -c '%y' /.CONTAINER_VERSION |sed 's|\(.*\)\.[0-9]* \(.*\)|\1 \2|g')" || true diff --git a/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf b/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf index c5d86ec..cc0562e 100755 --- a/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf +++ b/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf @@ -1,4 +1,5 @@ #!/command/with-contenv bash +#shellcheck shell=bash disable=SC1091 source /scripts/common