mirror of
https://github.com/krateng/maloja.git
synced 2023-08-10 21:12:55 +03:00
Janky self-restarter
This commit is contained in:
@@ -12,6 +12,7 @@ from urllib.error import *
|
||||
import sys
|
||||
import signal
|
||||
import os
|
||||
import restarter
|
||||
|
||||
|
||||
MAIN_PORT = 42010
|
||||
@@ -67,6 +68,12 @@ def database_post(pth):
|
||||
def shutdown():
|
||||
graceful_exit()
|
||||
|
||||
@webserver.route("/restart")
|
||||
def restart():
|
||||
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
|
||||
restarter.restart()
|
||||
os._exit(42)
|
||||
|
||||
def graceful_exit(sig=None,frame=None):
|
||||
urllib.request.urlopen("http://[::1]:" + str(DATABASE_PORT) + "/sync")
|
||||
log("Server shutting down...")
|
||||
|
||||
Reference in New Issue
Block a user