diff --git a/README.md b/README.md index e00d45b..2fef106 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ The following parameters must be set (mandatory) for the container to function: | `S6_SERVICES_GRACETIME` | Optional, set to 30000 when saving traces / globe_history | | `3000` | | `LOGLEVEL` | `verbose` (all messages), `error` (errors only), `none` (minimal) | | `verbose` | | `MLAT_STARTUP_STAGGER` | mlat-client startup staggering for tidy logs (reduce for quicker startup) | | `15` | +| `MAX_GLOBE_HISTORY` | Maximum number of days that `globe_history` data (used to produce heatmaps and ptracks) is retained. Note - this parameter doesn't affect the data used to produce `graphs1090` statistics | | Unset | `READSB_EXTRA_ARGS` just passes arguments to the commandline, you can check this file for more options for wiedehopf's readsb fork: diff --git a/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/dependencies.d/startup b/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/dependencies.d/startup new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/run b/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/run new file mode 100755 index 0000000..ea60751 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/run @@ -0,0 +1,2 @@ +#!/bin/sh +exec /etc/s6-overlay/scripts/cleanup_globe_history diff --git a/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/type b/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/cleanup_globe_history/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/cleanup_globe_history b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/cleanup_globe_history new file mode 100755 index 0000000..e69de29 diff --git a/rootfs/etc/s6-overlay/scripts/cleanup_globe_history b/rootfs/etc/s6-overlay/scripts/cleanup_globe_history new file mode 100755 index 0000000..205daa5 --- /dev/null +++ b/rootfs/etc/s6-overlay/scripts/cleanup_globe_history @@ -0,0 +1,39 @@ +#!/command/with-contenv bash +# shellcheck shell=bash disable=SC2015,SC2016,SC1091,SC2001,SC2154 + +#--------------------------------------------------------------------------------------------- +# Script to remove Globe_History files older than xxx days - this to ensure that the disk +# doesn't fill up with (unwanted) history files) + +# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors +# Core script copyright and provided by Matthias Wirth (wiedehopf), used with permission +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with this program. +# If not, see . +#--------------------------------------------------------------------------------------------- + +source /scripts/common + +if [[ -z "$MAX_GLOBE_HISTORY" ]]; then + "${s6wrap[@]}" echo "MAX_GLOBE_HISTORY not set - we will not expire any globe_history files" + exec sleep infinity +fi + +cutoffepoch="$(date -d"-${MAX_GLOBE_HISTORY} days" +%s)" + +for dir in $(find /var/globe_history -maxdepth 3 -mindepth 3 | grep -o -E -e '[0-9]{4}/[0-9]{2}/[0-9]{2}$'); do + if (( $(date -d "$dir" +%s) < cutoffepoch )); then + echo rm -rf "/var/globe_history/$dir" + fi +done + +exec sleep 24h diff --git a/rootfs/scripts/interpret_ultrafeeder_config b/rootfs/scripts/interpret_ultrafeeder_config index ce70123..1ea517a 100755 --- a/rootfs/scripts/interpret_ultrafeeder_config +++ b/rootfs/scripts/interpret_ultrafeeder_config @@ -1,6 +1,6 @@ #!/usr/bin/with-contenv bash -# shellcheck shell=bash disable=SC2015 +# shellcheck shell=bash disable=SC2015,SC2154 # # This scripts should be sourced by the /etc/services.d/xxx/run modules for # readsb, mlat-client, and mlathub. It interprets the ULTRAFEEDER_CONFIG / ULTRAFEEDER_NET_CONNECTOR parameter @@ -97,6 +97,14 @@ do done # Now add $readsb_str to the READSB_CONF_ARR() as --net-connector argument: READSB_CONF_ARR+=("--net-connector=${readsb_str}") + + if [[ ${param[1],,} == "in.adsb.lol" ]]; then + myadsblol="$(curl -sLD - https://my.adsb.lol -o /dev/null -w '%{url_effective}' 2>&1 | sed '/location: /h;g;$!d;s/^.* \(.*\)$/\1/')" + if [[ -n "$myadsblol" ]] && [[ ! $myadsblol =~ sorry-but-i-could-not-find-your-receiver ]]; then + "${s6wrap[@]}" echo "ADSB.LOL station map available at $myadsblol" + fi + fi + ;; mlat)