From 27bab412e005fa3aea08e088b9ee0f83405685b7 Mon Sep 17 00:00:00 2001 From: kx1t <15090643+kx1t@users.noreply.github.com> Date: Mon, 25 Mar 2024 13:52:24 -0400 Subject: [PATCH 1/3] fix message monitor --- rootfs/etc/s6-overlay/scripts/message-monitor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rootfs/etc/s6-overlay/scripts/message-monitor b/rootfs/etc/s6-overlay/scripts/message-monitor index 1efd2df..5355ba5 100755 --- a/rootfs/etc/s6-overlay/scripts/message-monitor +++ b/rootfs/etc/s6-overlay/scripts/message-monitor @@ -35,14 +35,16 @@ do "${s6wrap[@]}" echo "[STARTING] Receiver starting: No messages have been received as the container is still starting" new_msg_count=0 elif (( new_msg_count == old_msg_count )); then - # only print and restart if we're within the adjustment timeframe - if (( $(date +%s) < $(date -d "${READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME%%-*} today" +%s) )); then - "${s6wrap[@]}" echo "[WARNING] Receiver appears stale: No messages received since last run of the Messages Monitor ($secs_since_last_check secs ago)" - + "${s6wrap[@]}" echo "[WARNING] Receiver appears stale: No messages received since last run of the Messages Monitor ($secs_since_last_check secs ago)" + # only restart if we're within the adjustment timeframe + if (( $(date +%s) >= $(date -d "${READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME%%-*} today" +%s) )) \ + && (( $(date +%s) <= $(date -d "${READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME##*-} today" +%s) )); then if chk_enabled "$DUMP978_MSG_MONITOR_RESTART_WHEN_STALE"; then "${s6wrap[@]}" echo "[WARNING] Restarting the dump978 service..." s6-svc -r /run/service/dump978 2>/dev/null || true fi + else + "${s6wrap[@]}" echo " No action is taken since we're outside the Adjustment Timeframe of ${READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME}" fi elif (( new_msg_count > old_msg_count )); then "${s6wrap[@]}" echo "[INFO] Receiver is OK: $(( new_msg_count - old_msg_count )) messages received since last run of the Messages Monitor ($secs_since_last_check secs ago)" From ffc16fa1f97bbf95b12f5ffd50f5ee31fd5ccfd9 Mon Sep 17 00:00:00 2001 From: kx1t <15090643+kx1t@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:25:33 -0400 Subject: [PATCH 2/3] Restart When Stale set to default-TRUE --- rootfs/etc/s6-overlay/scripts/message-monitor | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rootfs/etc/s6-overlay/scripts/message-monitor b/rootfs/etc/s6-overlay/scripts/message-monitor index 5355ba5..6bbae59 100755 --- a/rootfs/etc/s6-overlay/scripts/message-monitor +++ b/rootfs/etc/s6-overlay/scripts/message-monitor @@ -4,8 +4,13 @@ source /scripts/common mkdir -p /run/stats s6wrap=(s6wrap --quiet --prepend="$(basename "$0")" --timestamps --args) + +# Adjustment Timeframe is the same as used for AutoGain, with a default of 0800-1800 "container time" if omitted READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME="${DUMP978_AUTOGAIN_ADJUSTMENT_TIMEFRAME:-${READSB_AUTOGAIN_ADJUSTMENT_TIMEFRAME:-0800-1800}}" +# Restart When Stale is default-TRUE. This is acceptable - worst case, we'd restart the dump978 s6 service once every 30 minutes +DUMP978_MSG_MONITOR_RESTART_WHEN_STALE="${DUMP978_MSG_MONITOR_RESTART_WHEN_STALE:-true}" + while : do # Make sure we're receiving messages from the SDR From e78966864bede971da39ac8dd1221c426ba4301c Mon Sep 17 00:00:00 2001 From: kx1t <15090643+kx1t@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:27:02 -0400 Subject: [PATCH 3/3] Restart When Stale is default `true` --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8744eb8..3202ce6 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ You should now be feeding ADSB-ES & UAT to the "new" aggregators, FlightAware, a | `LAT` | Latitude of your receiver. Only required if you want range statistics for InfluxDB, Prometheus, or tar1090/ultrafeeder graphs. | Unset | | `LON` | Longitude of your receiver. Only required if you want range statistics for InfluxDB, Prometheus, or tar1090/ultrafeeder graphs. | Unset | | `DUMP978_MSG_MONITOR_INTERVAL` | Interval between runs of the Message Monitor that checks if new messages are received. Format of value is anything that is accepted by the Linux `sleep` command | Unset (30 minutes) | -| `DUMP978_MSG_MONITOR_RESTART_WHEN_STALE` | If set to `true`/`on`/`yes`/`1`, the receiver process is restarted when no messages are received during the monitoring interval | Unset (`false`) | +| `DUMP978_MSG_MONITOR_RESTART_WHEN_STALE` | If set to `true`/`on`/`yes`/`1`, the receiver process is restarted when no messages are received during the monitoring interval | `true` | ### `dump978-fa` General Options