1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-29 01:00:13 +00:00
This commit is contained in:
kx1t 2023-05-04 14:33:31 -04:00
parent f9ef1fe6b1
commit 0f87787a62

View file

@ -146,7 +146,7 @@ do
fi fi
if [ -n "${lon_arg}" ]; then if [ -n "${lon_arg}" ]; then
MLAT_PARAM+=(--lat "${lon_arg}") MLAT_PARAM+=(--lon "${lon_arg}")
elif [ -n "${LONG}" ]; then elif [ -n "${LONG}" ]; then
MLAT_PARAM+=(--lon "${LONG}") MLAT_PARAM+=(--lon "${LONG}")
elif [ -n "${READSB_LON}" ]; then elif [ -n "${READSB_LON}" ]; then
@ -154,7 +154,7 @@ do
fi fi
if [ -n "${alt_arg}" ]; then if [ -n "${alt_arg}" ]; then
MLAT_PARAM+=(--lat "${alt_arg}") MLAT_PARAM+=(--alt "${alt_arg}")
elif [ -n "${ALT}" ]; then elif [ -n "${ALT}" ]; then
MLAT_PARAM+=(--alt "${ALT}") MLAT_PARAM+=(--alt "${ALT}")
elif [ -n "${READSB_ALT}" ]; then elif [ -n "${READSB_ALT}" ]; then
@ -208,9 +208,10 @@ do
# pid_array is indexed by the PID of each mlat_client and contains the MLAT_PARAMs for that instance # 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 # This is done so we can monitor them and restart them if needed
pid_array[$!]="${MLAT_PARAM[*]}" pid_array[$!]="${MLAT_PARAM[*]}"
sleep 5
done done
sleep 5
# All MLAT Clients are up, so set the flag. This flag is read by MLATHUB as a sign that it's # 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 # safe to start up
touch /run/mlathub_up touch /run/mlathub_up
@ -224,15 +225,18 @@ do
then then
# it exited - let's restart: # it exited - let's restart:
sleep "${RESTARTTIMER}" 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 # shellcheck disable=SC2086
execstring="$(echo ${MLAT_CMD} ${pid_array[$mlat_pid]} | xargs)" execstring="$(echo ${MLAT_CMD} ${pid_array[$mlat_pid]} | xargs)"
#shellcheck disable=SC2069,SC2086 #shellcheck disable=SC2069,SC2086
if [[ -z "${LOGLEVEL}" ]] || [[ "${LOGLEVEL,,}" == "verbose" ]]; then 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 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 elif [[ "${LOGLEVEL,,}" == "none" ]]; then
{ exec ${execstring} >/dev/null 2>/dev/null; } & { exec ${execstring} >/dev/null 2>/dev/null; } &
fi fi