add server restart api endpoint

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-07-08 10:09:36 +02:00
parent cfd31599b4
commit 3158468dc4
4 changed files with 49 additions and 39 deletions
+7 -1
View File
@@ -89,10 +89,16 @@ def post_log(req: models.ReqPostLog):
return Response(status_code=204)
def post_shutdown(background_tasks: BackgroundTasks):
log.info("Shutdown request received")
log.info("Server shutdown request received")
background_tasks.add_task(os._exit, 0)
return Response(status_code=204)
def post_restart(background_tasks: BackgroundTasks):
log.info("Server restart request received")
from installer import restart
background_tasks.add_task(restart)
return Response(status_code=204)
def get_cmd_flags():
return vars(shared.cmd_opts)