From 0f87787a62decdce6b3a1c20f9ee78a378c79f1d Mon Sep 17 00:00:00 2001 From: kx1t Date: Thu, 4 May 2023 14:33:31 -0400 Subject: [PATCH] fixes --- rootfs/etc/services.d/mlat-client/run | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/rootfs/etc/services.d/mlat-client/run b/rootfs/etc/services.d/mlat-client/run index 7a981e9..bebc6ef 100644 --- a/rootfs/etc/services.d/mlat-client/run +++ b/rootfs/etc/services.d/mlat-client/run @@ -146,7 +146,7 @@ do fi if [ -n "${lon_arg}" ]; then - MLAT_PARAM+=(--lat "${lon_arg}") + MLAT_PARAM+=(--lon "${lon_arg}") elif [ -n "${LONG}" ]; then MLAT_PARAM+=(--lon "${LONG}") elif [ -n "${READSB_LON}" ]; then @@ -154,7 +154,7 @@ do fi if [ -n "${alt_arg}" ]; then - MLAT_PARAM+=(--lat "${alt_arg}") + MLAT_PARAM+=(--alt "${alt_arg}") elif [ -n "${ALT}" ]; then MLAT_PARAM+=(--alt "${ALT}") elif [ -n "${READSB_ALT}" ]; then @@ -163,7 +163,7 @@ do # Add UUID to instance if [ -n "$uuid_arg" ]; then - MLAT_PARAM+=("--uuid ${uuid_arg}") + MLAT_PARAM+=("--uuid ${uuid_arg}") elif [ -n "${UUID}" ]; then MLAT_PARAM+=("--uuid ${UUID}") else @@ -208,9 +208,10 @@ do # pid_array is indexed by the PID of each mlat_client and contains the MLAT_PARAMs for that instance # This is done so we can monitor them and restart them if needed pid_array[$!]="${MLAT_PARAM[*]}" - sleep 5 done +sleep 5 + # All MLAT Clients are up, so set the flag. This flag is read by MLATHUB as a sign that it's # safe to start up touch /run/mlathub_up @@ -224,15 +225,18 @@ do then # it exited - let's restart: sleep "${RESTARTTIMER}" - [[ "${LOGLEVEL,,}" != "none" ]] && s6wrap --prepend="${APPNAME}" --timestamps --args echo "MLAT_Client $(awk '{print $6}' <<< "${pid_array[$mlat_pid]}") exited. Attempting to restart. ${pid_array[$mlat_pid]}" || true + servername="$(awk '{print $4}' <<< "${pid_array[$mlat_pid]}")" + servername="${servername%%:*}" + + [[ "${LOGLEVEL,,}" != "none" ]] && s6wrap --prepend="${APPNAME}[${servername}" --timestamps --args echo "MLAT_Client ${servername} exited. Attempting to restart." || true # shellcheck disable=SC2086 execstring="$(echo ${MLAT_CMD} ${pid_array[$mlat_pid]} | xargs)" #shellcheck disable=SC2069,SC2086 if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then - { exec s6wrap --prepend="${APPNAME}][${params[0]}" --timestamps --args ${execstring} 2>&1; } & + { exec s6wrap --prepend="${APPNAME}][${servername}" --timestamps --args ${execstring} 2>&1; } & elif [[ "${LOGLEVEL,,}" == "error" ]]; then - { exec s6wrap --prepend="${APPNAME}][${params[0]}" --timestamps --args ${execstring} 2>&1 >/dev/null; } & + { exec s6wrap --prepend="${APPNAME}][${servername}" --timestamps --args ${execstring} 2>&1 >/dev/null; } & elif [[ "${LOGLEVEL,,}" == "none" ]]; then { exec ${execstring} >/dev/null 2>/dev/null; } & fi