From bee0895861d131a6a793fe07ce507a3c32dbd257 Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Fri, 8 Dec 2023 20:04:38 -0700 Subject: [PATCH] fix s6 claiming error on command wrapped in timeout and fix spelling on threshold --- Dockerfile | 2 +- README.md | 28 ++++++++++++------------ rootfs/etc/s6-overlay/scripts/hfdl_stats | 5 ++--- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee38401..bfece9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ENV DEVICE_INDEX="" \ SOAPYSDR="" \ SERVER_PORT="5556" \ VDLM_FILTER_ENABLE="TRUE" \ - MIN_MESSAGE_THESHOLD="5" + MIN_MESSAGE_THRESHOLD="5" SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/README.md b/README.md index e0682f4..9613710 100644 --- a/README.md +++ b/README.md @@ -66,20 +66,20 @@ Keep in mind not every SDR is usable with HF decoding. If you have an SDR that i ## Configuration options -| Variable | Description | Required | Default | -| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- | -| `TZ` | Your timezone | No | UTC | -| `SOAPYSDRDRIVER` | SoapySDR driver. Required! Should be in the format that you would use to pass in to soapysdr. See the compose example above. | Yes | `unset` | -| `GAIN_TYPE` | The type of gain to use. Can be `--gain` or `--gain-elements`. | Yes | `unset` | -| `GAIN` | The gain to use. If used with `GAIN_TYPE=--gain-elements` then this should be in the format your SDR expects. For Airspy style devices something like `IFGR=53,RFGR=2`. Otherwise, if used with `GAIN_TYPE=--gain` then it should be a single value representing a gain value your SDR supports. Example above in the compose section. | Yes | `unset` | -| `SOAPYSAMPLERATE` | The sample rate to use. The sample rate that your SDR would expect. | Yes | `unset` | -| `FEED_ID` | The feed ID to use. This is the ID that will be used to identify your feed on the ACARS Hub and any site, such as [airframes](airframes.io) that you feed. | Yes | `unset` | -| `ZMQ_MODE` | The ZMQ mode to use. Can be `server` or `client`. | Yes | `unset` | -| `ZMQ_ENDPOINT` | The ZMQ endpoint to use. If `ZMQ_MODE=server` then this should be the endpoint that `acars_router` and other consumers will connect to. If `ZMQ_MODE=client` then this should be the endpoint that a ZMQ server is listening on and expects data from. | Yes | `unset` | -| `SERVER` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the IP address of a consumer | No | `unset` | -| `SERVER_PORT` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the port of a consumer | No | `unset` | -| `TIMEOUT` | The number of seconds that the frequency selector will run each group of frequencies for to pick the optimal HFDL frequencies for monitoring. | No | `90` | -| `MIN_MESSAGE_THESHOLD` | The minimum number of messages that should be received, on average, during the rolling 30 minute time period. If the average is below this threshold the frequency selector will be re-run. | No | `5` | +| Variable | Description | Required | Default | +| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- | +| `TZ` | Your timezone | No | UTC | +| `SOAPYSDRDRIVER` | SoapySDR driver. Required! Should be in the format that you would use to pass in to soapysdr. See the compose example above. | Yes | `unset` | +| `GAIN_TYPE` | The type of gain to use. Can be `--gain` or `--gain-elements`. | Yes | `unset` | +| `GAIN` | The gain to use. If used with `GAIN_TYPE=--gain-elements` then this should be in the format your SDR expects. For Airspy style devices something like `IFGR=53,RFGR=2`. Otherwise, if used with `GAIN_TYPE=--gain` then it should be a single value representing a gain value your SDR supports. Example above in the compose section. | Yes | `unset` | +| `SOAPYSAMPLERATE` | The sample rate to use. The sample rate that your SDR would expect. | Yes | `unset` | +| `FEED_ID` | The feed ID to use. This is the ID that will be used to identify your feed on the ACARS Hub and any site, such as [airframes](airframes.io) that you feed. | Yes | `unset` | +| `ZMQ_MODE` | The ZMQ mode to use. Can be `server` or `client`. | Yes | `unset` | +| `ZMQ_ENDPOINT` | The ZMQ endpoint to use. If `ZMQ_MODE=server` then this should be the endpoint that `acars_router` and other consumers will connect to. If `ZMQ_MODE=client` then this should be the endpoint that a ZMQ server is listening on and expects data from. | Yes | `unset` | +| `SERVER` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the IP address of a consumer | No | `unset` | +| `SERVER_PORT` | If you want this container to forward JSON data, via TCP, to a consumer then set this to the port of a consumer | No | `unset` | +| `TIMEOUT` | The number of seconds that the frequency selector will run each group of frequencies for to pick the optimal HFDL frequencies for monitoring. | No | `90` | +| `MIN_MESSAGE_THRESHOLD` | The minimum number of messages that should be received, on average, during the rolling 30 minute time period. If the average is below this threshold the frequency selector will be re-run. | No | `5` | ## What this thing does under the hood, or why don't I specify frequencies? diff --git a/rootfs/etc/s6-overlay/scripts/hfdl_stats b/rootfs/etc/s6-overlay/scripts/hfdl_stats index 31db265..4dfac4d 100755 --- a/rootfs/etc/s6-overlay/scripts/hfdl_stats +++ b/rootfs/etc/s6-overlay/scripts/hfdl_stats @@ -17,9 +17,8 @@ fi # Start our stats loop while true; do - # capture 5 mins of flows - "${s6wrap[@]}" timeout --foreground 300s socat -u TCP:127.0.0.1:15556 CREATE:/run/hfdl/hfdl.past5min.json + timeout --foreground 300s socat -u TCP:127.0.0.1:15556 CREATE:/run/hfdl/hfdl.past5min.json # if the port isn't reachable, this file isn't created, either container is shutting down or hfdl_server isn't reachable # in both cases let's exit, if this should still be running it will be restarted @@ -43,7 +42,7 @@ while true; do # now check the last 6 files for messages average_message_count=$(sed 's/}{/}\n{/g' /run/hfdl/hfdl.{0..5}.json | wc -l) average_message_count=$((average_message_count / 6)) - if [[ $average_message_count -lt $MIN_MESSAGE_THESHOLD ]]; then + if [[ $average_message_count -lt $MIN_MESSAGE_THRESHOLD ]]; then "${s6wrap[@]}" echo "Average messages (${average_message_count}) received in last 30 minutes is less then the threshold (${MIN_MESSAGE_THRESHOLD})" "${s6wrap[@]}" echo "Restarting dumphfdl to rerun the frequency optimizer" s6-svc -r /run/service/dumphfdl