mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 09:15:22 +03:00
improved user experience
This commit is contained in:
parent
b587e83327
commit
d8c3ef7521
@ -523,12 +523,7 @@ def restart_frigate(mqtt_client, topic_prefix, from_ui = 0):
|
|||||||
|
|
||||||
def on_publish(client,userdata,result):
|
def on_publish(client,userdata,result):
|
||||||
time.sleep(0.67)
|
time.sleep(0.67)
|
||||||
rc, docker = 1, "/usr/local/bin/docker"
|
os.kill(os.getpid(), signal.SIGTERM)
|
||||||
if os.access(docker, os.X_OK) and os.path.isfile("/var/run/docker.sock"):
|
|
||||||
rc = sp.Popen(f"{docker} restart $(hostname)", shell=True).wait()
|
|
||||||
if rc:
|
|
||||||
# Sometimes you have to wait a long time like this
|
|
||||||
os.kill(os.getpid(), signal.SIGTERM)
|
|
||||||
|
|
||||||
mqtt_client.on_publish = on_publish
|
mqtt_client.on_publish = on_publish
|
||||||
mqtt_client.publish(f"{topic_prefix}/restarted", int(from_ui))
|
mqtt_client.publish(f"{topic_prefix}/restarted", int(from_ui))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user