Browse Source

Improve handling of binary restarts (macOS / Windows)

pull/1666/head
Safihre 5 years ago
parent
commit
3e9bfba4d6
  1. 3
      SABnzbd.py
  2. 16
      sabnzbd/__init__.py

3
SABnzbd.py

@ -1519,6 +1519,7 @@ def main():
# Check for auto-restart request
# Or special restart cases like Mac and WindowsService
if sabnzbd.TRIGGER_RESTART:
logging.info("Performing triggered restart")
# Shutdown
sabnzbd.shutdown_program()
@ -1537,7 +1538,7 @@ def main():
my_name = sabnzbd.MY_FULLNAME.replace("/Contents/MacOS/SABnzbd", "")
my_args = " ".join(sys.argv[1:])
cmd = 'kill -9 %s && open "%s" --args %s' % (my_pid, my_name, my_args)
logging.info("Launching: ", cmd)
logging.info("Launching: %s", cmd)
os.system(cmd)
elif sabnzbd.WIN_SERVICE:
# Use external service handler to do the restart

16
sabnzbd/__init__.py

@ -446,6 +446,14 @@ def trigger_restart(timeout=None):
if timeout:
time.sleep(timeout)
if sabnzbd.WIN32:
# Remove connection info for faster restart
del_connection_info()
# Leave the harder restarts to the polling in SABnzbd.py
if hasattr(sys, "frozen"):
sabnzbd.TRIGGER_RESTART = True
else:
# Add extra arguments
if sabnzbd.Downloader.paused:
sabnzbd.RESTART_ARGS.append("-p")
@ -455,14 +463,6 @@ def trigger_restart(timeout=None):
sabnzbd.halt()
cherrypy.engine.exit()
if sabnzbd.WIN32:
# Remove connection info for faster restart
del_connection_info()
# Leave the harder restarts to the polling in SABnzbd.py
if hasattr(sys, "frozen"):
sabnzbd.TRIGGER_RESTART = True
else:
# Do the restart right now
cherrypy.engine._do_execv()

Loading…
Cancel
Save