check for updates and offer option option to restart

This commit is contained in:
j 2014-08-22 18:42:08 +02:00
commit 0bd359f89d
5 changed files with 109 additions and 14 deletions

View file

@ -4,6 +4,7 @@ from __future__ import division, print_function
import os
import sys
import signal
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
@ -94,14 +95,20 @@ def run():
host = settings.server['address']
url = 'http://%s:%s/' % (host, settings.server['port'])
print('open browser at %s' % url)
def shutdown():
if state.downloads:
state.downloads.join()
if state.tasks:
state.tasks.join()
if state.nodes:
state.nodes.join()
http_server.stop()
signal.signal(signal.SIGTERM, shutdown)
try:
state.main.start()
except:
print('shutting down...')
if state.downloads:
state.downloads.join()
if state.tasks:
state.tasks.join()
if state.nodes:
state.nodes.join()
shutdown()