2023-08-31 02:59:09 +00:00
|
|
|
#!/command/with-contenv bash
|
2023-04-08 21:07:11 +00:00
|
|
|
# shellcheck shell=bash disable=SC1091
|
2023-03-28 20:01:27 +00:00
|
|
|
|
2023-04-08 21:07:11 +00:00
|
|
|
source /scripts/common
|
|
|
|
|
2024-03-29 23:21:45 +00:00
|
|
|
#---------------------------------------------------------------------------------------------
|
|
|
|
# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors
|
|
|
|
#
|
|
|
|
# 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 <https://www.gnu.org/licenses/>.
|
|
|
|
#---------------------------------------------------------------------------------------------
|
|
|
|
|
2023-04-08 21:07:11 +00:00
|
|
|
if chk_enabled "$PROMETHEUS_ENABLE"; then
|
2023-03-28 20:01:27 +00:00
|
|
|
while [[ ! -f /run/readsb-prometheus.prom ]]
|
|
|
|
do
|
|
|
|
sleep 1
|
|
|
|
done
|
2023-05-05 08:16:32 +00:00
|
|
|
trap "pkill -P $$ || true; s6wrap --timestamps --prepend=prometheus-readsb --quiet --args echo 'service stopping'; exit 0" SIGTERM SIGINT SIGHUP SIGQUIT
|
2024-02-19 11:52:06 +00:00
|
|
|
echo -e "HTTP/1.1 200 OK\nContent-Type: text/plain\n\n$(cat /run/readsb-prometheus.prom)" | ncat -l "${PROMETHEUSPORT:-9274}" > /dev/null 2>&1 &
|
2023-05-05 08:16:32 +00:00
|
|
|
wait
|
2023-03-28 20:01:27 +00:00
|
|
|
else
|
2023-05-05 08:16:32 +00:00
|
|
|
exec sleep infinity
|
2023-03-28 20:01:27 +00:00
|
|
|
fi
|