Skip to content

Commit

Permalink
fix s6 claiming error on command wrapped in timeout and fix spelling …
Browse files Browse the repository at this point in the history
…on threshold
  • Loading branch information
fredclausen committed Dec 9, 2023
1 parent 4c180d8 commit bee0895
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
5 changes: 2 additions & 3 deletions rootfs/etc/s6-overlay/scripts/hfdl_stats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bee0895

Please sign in to comment.