1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-12-26 14:22:00 +00:00
docker-adsb-ultrafeeder/rootfs/etc/s6-overlay/scripts/prometheus-readsb
2024-03-29 19:21:45 -04:00

32 lines
1.4 KiB
Text
Executable file

#!/command/with-contenv bash
# shellcheck shell=bash disable=SC1091
source /scripts/common
#---------------------------------------------------------------------------------------------
# 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/>.
#---------------------------------------------------------------------------------------------
if chk_enabled "$PROMETHEUS_ENABLE"; then
while [[ ! -f /run/readsb-prometheus.prom ]]
do
sleep 1
done
trap "pkill -P $$ || true; s6wrap --timestamps --prepend=prometheus-readsb --quiet --args echo 'service stopping'; exit 0" SIGTERM SIGINT SIGHUP SIGQUIT
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 &
wait
else
exec sleep infinity
fi