1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-25 07:10:10 +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
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