2023-02-19 19:34:14 +03:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
|
# shellcheck shell=bash
|
|
|
|
|
# Start the go2rtc healthcheck service
|
|
|
|
|
|
|
|
|
|
set -o errexit -o nounset -o pipefail
|
|
|
|
|
|
|
|
|
|
echo "[INFO] Starting go2rtc healthcheck service..." >&2
|
|
|
|
|
|
|
|
|
|
while sleep 1m; do
|
|
|
|
|
# Check if the service is running
|
2023-02-19 19:53:41 +03:00
|
|
|
if ! timeout 10s curl -fsSL http://127.0.0.1:1984/api/streams >/dev/null; then
|
2023-02-19 19:58:02 +03:00
|
|
|
echo "[ERROR] The go2rtc service is not responding to ping, restarting..." >&2
|
2023-02-19 19:34:14 +03:00
|
|
|
# We can also use -r instead of -t to send kill signal rather than term
|
|
|
|
|
s6-svc -t /var/run/service/go2rtc
|
|
|
|
|
fi
|
|
|
|
|
done
|