Skip to content

Commit

Permalink
fix BEASTHOST ip resolution bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed Oct 23, 2023
1 parent af79bb7 commit 9819f4b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rootfs/etc/s6-overlay/scripts/radar1090
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ fi

beast_host="${BEASTHOST:-ultrafeeder}"
if ! valid_ip "$beast_host"; then
beast_host="$(dig "$beast_host" | awk '{if ($1 == "'"$beast_host"'.") print $5}')"
beast_host="$(dig "${BEASTHOST:-ultrafeeder}" | awk '{if ($1 == "'"${BEASTHOST:-ultrafeeder}"'.") print $5}')"
# If it fails, print error message and loop trying every 30 secs
if [[ -z "$beast_host" ]]; then
while [[ -z "$beast_host" ]]; do
if ! valid_ip "$beast_host"; then
while ! valid_ip "$beast_host"; do
"${s6wrap[@]}" --args echo "WARNING: BEASTHOST (\"${BEASTHOST:-ultrafeeder}\") cannot be resolved. Make sure that \"${BEASTHOST:-ultrafeeder}\" is running or check your BEASTHOST parameter setting. Trying again in 30 seconds."
sleep 30
beast_host="$(dig "$beast_host" | awk '{if ($1 == "'"$beast_host"'.") print $5}')"
beast_host="$(dig "$${BEASTHOST:-ultrafeeder}" | awk '{if ($1 == "'"${BEASTHOST:-ultrafeeder}"'.") print $5}')"
done
fi
chk_enabled "$VERBOSE" && "${s6wrap[@]}" --args echo "BEASTHOST (\"${BEASTHOST:-ultrafeeder}\") successfully resolved to $beast_host" || true
Expand Down

0 comments on commit 9819f4b

Please sign in to comment.