Support client restart without updating
This commit is contained in:
parent
77aa23a375
commit
5aab10fab2
3 changed files with 17 additions and 16 deletions
27
zeronet.py
27
zeronet.py
|
@ -20,7 +20,6 @@ def main():
|
|||
if main.update_after_shutdown: # Updater
|
||||
import gc
|
||||
import update
|
||||
import atexit
|
||||
# Try cleanup openssl
|
||||
try:
|
||||
if "lib.opensslVerify" in sys.modules:
|
||||
|
@ -42,16 +41,6 @@ def main():
|
|||
except Exception, err:
|
||||
print "Update error: %s" % err
|
||||
|
||||
# Close log files
|
||||
logger = sys.modules["main"].logging.getLogger()
|
||||
|
||||
for handler in logger.handlers[:]:
|
||||
handler.flush()
|
||||
handler.close()
|
||||
logger.removeHandler(handler)
|
||||
|
||||
atexit._run_exitfuncs()
|
||||
|
||||
except Exception, err: # Prevent closing
|
||||
import traceback
|
||||
try:
|
||||
|
@ -60,13 +49,21 @@ def main():
|
|||
except Exception, log_err:
|
||||
print "Failed to log error:", log_err
|
||||
traceback.print_exc()
|
||||
from src.Config import config
|
||||
from Config import config
|
||||
traceback.print_exc(file=open(config.log_dir + "/error.log", "a"))
|
||||
|
||||
if main and main.update_after_shutdown: # Updater
|
||||
# Restart
|
||||
gc.collect() # Garbage collect
|
||||
if main and (main.update_after_shutdown or main.restart_after_shutdown): # Updater
|
||||
import atexit
|
||||
print "Restarting..."
|
||||
# Close log files
|
||||
logger = sys.modules["main"].logging.getLogger()
|
||||
|
||||
for handler in logger.handlers[:]:
|
||||
handler.flush()
|
||||
handler.close()
|
||||
logger.removeHandler(handler)
|
||||
|
||||
atexit._run_exitfuncs()
|
||||
import time
|
||||
time.sleep(1) # Wait files to close
|
||||
args = sys.argv[:]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue