mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-21 13:20:11 +00:00
make LOGLEVEL interpretation consistent
This commit is contained in:
parent
0a0fe65066
commit
8aa61a697c
6 changed files with 41 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -17,10 +17,17 @@
|
|||
# If not, see <https://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------------------------------
|
||||
|
||||
[[ -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
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/command/with-contenv bash
|
||||
#shellcheck shell=bash disable=SC1091
|
||||
|
||||
source /scripts/common
|
||||
|
||||
|
|
Loading…
Reference in a new issue