Add timeout to go2rtc healthcheck

This commit is contained in:
Felipe Santos 2023-02-19 13:53:41 -03:00
parent 4d8821c2d7
commit 47a1e9fc90
4 changed files with 8 additions and 11 deletions

View File

@ -11,7 +11,7 @@ readonly exit_code_service="${1}"
readonly exit_code_signal="${2}"
readonly service="Frigate"
echo "Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})" >&2
echo "[INFO] Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})" >&2
if [[ "${exit_code_service}" -eq 256 ]]; then
if [[ "${exit_code_container}" -eq 0 ]]; then
@ -21,10 +21,6 @@ elif [[ "${exit_code_service}" -ne 0 ]]; then
if [[ "${exit_code_container}" -eq 0 ]]; then
echo "${exit_code_service}" >/run/s6-linux-init-container-results/exitcode
fi
else
# Exit code 0 is expected when Frigate is restarted by the user. In this case,
# we create a signal for the go2rtc finish script to tolerate the restart.
touch /dev/shm/restarting-frigate
fi
exec /run/s6/basedir/bin/halt

View File

@ -8,7 +8,7 @@ echo "[INFO] Starting go2rtc healthcheck service..." >&2
while sleep 1m; do
# Check if the service is running
if ! curl -fsSL http://127.0.0.1:1984/api/streams >/dev/null; then
if ! timeout 10s curl -fsSL http://127.0.0.1:1984/api/streams >/dev/null; then
echo "[ERROR] The go2rtc is not responding to ping, restarting it..." >&2
# We can also use -r instead of -t to send kill signal rather than term
s6-svc -t /var/run/service/go2rtc

View File

@ -11,7 +11,7 @@ readonly exit_code_service="${1}"
readonly exit_code_signal="${2}"
readonly service="NGINX"
echo "Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})" >&2
echo "[INFO] Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})" >&2
if [[ "${exit_code_service}" -eq 256 ]]; then
if [[ "${exit_code_container}" -eq 0 ]]; then