From feeb7107d5a26c6a4f7eeefeb0e02edc556ca49b Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Tue, 24 Jan 2023 10:27:57 -0300 Subject: [PATCH] Fix Frigate stuck at finishing when restarting from UI (#5216) --- frigate/util.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frigate/util.py b/frigate/util.py index 2987099e8..69ead2a7a 100755 --- a/frigate/util.py +++ b/frigate/util.py @@ -628,8 +628,13 @@ def clipped(obj, frame_shape): def restart_frigate(): - # S6 overlay is configured to exit once the Frigate process exits - os.kill(os.getpid(), signal.SIGTERM) + proc = psutil.Process(1) + # if this is running via s6, sigterm pid 1 + if proc.name() == "s6-svscan": + proc.terminate() + # otherwise, just try and exit frigate + else: + os.kill(os.getpid(), signal.SIGTERM) class EventsPerSecond: