Decrease time window and use curl's timeout flag

This commit is contained in:
Felipe Santos 2023-02-19 16:00:20 -03:00
parent 635b9b9f29
commit 0593c9ede9

View File

@ -10,9 +10,9 @@ set -o errexit -o nounset -o pipefail
sleep 10s sleep 10s
echo "[INFO] Starting go2rtc healthcheck service..." echo "[INFO] Starting go2rtc healthcheck service..."
while sleep 60s; do while sleep 30s; do
# Check if the service is running # Check if the service is running
if ! timeout 10s curl -fsSL -o /dev/null http://127.0.0.1:1984/api/streams 2>&1; then if ! curl --connect-timeout 10 --fail --silent --show-error --output /dev/null http://127.0.0.1:1984/api/streams 2>&1; then
echo "[ERROR] The go2rtc service is not responding to ping, restarting..." echo "[ERROR] The go2rtc service is not responding to ping, restarting..."
# We can also use -r instead of -t to send kill signal rather than term # We can also use -r instead of -t to send kill signal rather than term
s6-svc -t /var/run/service/go2rtc 2>&1 s6-svc -t /var/run/service/go2rtc 2>&1