From 934b16723b219c6e5e5f1c4b2fc4cca723903c4d Mon Sep 17 00:00:00 2001 From: trademark789 <109932380+trademark789@users.noreply.github.com> Date: Sun, 19 Nov 2023 08:08:42 -0500 Subject: [PATCH] make go2rtc always rebuild config at startup (#8664) * make go2rtc always rebuild config at startup /dev/shm can be left mounted (in fact im pretty sure it's always left mounted) on the docker host after shutting down the frigate container. If we only check that the file doesn't exist, stale data gets re-read every startup This will make troubleshooting a nightmare for the average user. I had given up troubleshooting go2rtc several times because of this. * generate config after supervisor data is loaded * Fix fi * fix fi --------- Co-authored-by: Nicolas Mowen --- docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run index fd5fcb568..492dc8973 100755 --- a/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run +++ b/docker/main/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run @@ -45,8 +45,12 @@ function get_ip_and_port_from_supervisor() { export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+') +if [[ -f "/dev/shm/go2rtc.yaml" ]]; then + echo "[INFO] Removing stale config from last run..." + rm /dev/shm/go2rtc.yaml + if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then - echo "[INFO] Preparing go2rtc config..." + echo "[INFO] Preparing new go2rtc config..." if [[ -n "${SUPERVISOR_TOKEN:-}" ]]; then # Running as a Home Assistant add-on, infer the IP address and port @@ -54,6 +58,8 @@ if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then fi python3 /usr/local/go2rtc/create_config.py +else + echo "[WARNING] Unable to remove existing go2rtc config. Changes made to your frigate config file may not be recognized. Please remove the /dev/shm/go2rtc.yaml from your docker host manually." fi readonly config_path="/config"