Restart improvements

This commit is contained in:
Felipe Santos 2023-01-17 13:53:07 -03:00
parent 5feaa0461f
commit 92e702a33c
5 changed files with 10 additions and 15 deletions

View File

@ -22,10 +22,9 @@ elif [[ "${exit_code_service}" -ne 0 ]]; then
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
fi
else
# If the service exited with code 0, then we want to set the container exit code to 1
if [[ "${exit_code_container}" -eq 0 ]]; then
echo "1" > /run/s6-linux-init-container-results/exitcode
fi
# 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

@ -22,8 +22,9 @@ elif [[ "${exit_code_service}" -ne 0 ]]; then
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
fi
else
# If the service exited with code 0, then we want to set the container exit code to 1 if it's 0
if [[ "${exit_code_container}" -eq 0 ]]; then
# go2rtc is not supposed to exit, so even when it exits with 0 we make the
# container with 1. We only tolerate it when Frigate is restarting.
if [[ "${exit_code_container}" -eq 0 && ! -f /dev/shm/restarting-frigate ]]; then
echo "1" > /run/s6-linux-init-container-results/exitcode
fi
fi

View File

@ -769,7 +769,7 @@ def config_save():
logging.error(f"Error restarting Frigate: {e}")
return "Config successfully saved, unable to restart Frigate", 200
return "Config successfully saved, restarting...", 200
return "Config successfully saved, restarting (this can take up to one minute)...", 200
else:
return "Config successfully saved.", 200

View File

@ -628,13 +628,8 @@ def clipped(obj, frame_shape):
def restart_frigate():
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)
# S6 overlay is configured to exit once the Frigate process exits
os.kill(os.getpid(), signal.SIGTERM)
class EventsPerSecond:

View File

@ -78,7 +78,7 @@ export default function AppBar() {
{showDialogWait ? (
<Prompt
title="Restart in progress"
text="Please wait a few seconds for the restart to complete before reloading the page."
text="This can take up to one minute, please wait before reloading the page."
/>
) : null}
</Fragment>