diff --git a/rootfs/etc/s6-overlay/scripts/radar1090 b/rootfs/etc/s6-overlay/scripts/radar1090 index e11566f..69c54eb 100755 --- a/rootfs/etc/s6-overlay/scripts/radar1090 +++ b/rootfs/etc/s6-overlay/scripts/radar1090 @@ -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