def shutdown(restart=False, update=False): cherrypy.engine.exit() SCHED.shutdown(wait=False) # Clear any sessions in the db - Not sure yet if we should do this. More testing required # logger.debug(u'Clearing Plex sessions.') # monitor.drop_session_db() CONFIG.write() if not restart and not update: logger.info('PlexPy is shutting down...') if update: logger.info('PlexPy is updating...') try: versioncheck.update() except Exception as e: logger.warn('PlexPy failed to update: %s. Restarting.', e) if CREATEPID: logger.info('Removing pidfile %s', PIDFILE) os.remove(PIDFILE) if restart: logger.info('PlexPy is restarting...') popen_list = [sys.executable, FULL_PATH] popen_list += ARGS if '--nolaunch' not in popen_list: popen_list += ['--nolaunch'] logger.info('Restarting PlexPy with %s', popen_list) subprocess.Popen(popen_list, cwd=os.getcwd()) os._exit(0)
def shutdown(restart=False, update=False): cherrypy.engine.exit() SCHED.shutdown(wait=False) CONFIG.write() if not restart and not update: logger.info('PlexPy is shutting down...') if update: logger.info('PlexPy is updating...') try: versioncheck.update() except Exception as e: logger.warn('PlexPy failed to update: %s. Restarting.', e) if CREATEPID: logger.info('Removing pidfile %s', PIDFILE) os.remove(PIDFILE) if restart: logger.info('PlexPy is restarting...') popen_list = [sys.executable, FULL_PATH] popen_list += ARGS if '--nolaunch' not in popen_list: popen_list += ['--nolaunch'] logger.info('Restarting PlexPy with %s', popen_list) subprocess.Popen(popen_list, cwd=os.getcwd()) os._exit(0)
def shutdown(restart=False, update=False): cherrypy.engine.exit() SCHED.shutdown(wait=False) CONFIG.write() if not restart and not update: logger.info('PlexPy is shutting down...') if update: logger.info('PlexPy is updating...') try: versioncheck.update() except Exception as e: logger.warn('PlexPy failed to update: %s. Restarting.', e) if CREATEPID: logger.info('Removing pidfile %s', PIDFILE) os.remove(PIDFILE) if restart: logger.info('PlexPy is restarting...') exe = sys.executable args = [exe, FULL_PATH] args += ARGS if '--nolaunch' not in args: args += ['--nolaunch'] logger.info('Restarting PlexPy with %s', args) os.execv(exe, args) os._exit(0)
def shutdown(restart=False, update=False): cherrypy.engine.exit() SCHED.shutdown(wait=False) CONFIG.write() if not restart and not update: logger.info('PlexPy is shutting down...') if update: logger.info('PlexPy is updating...') try: versioncheck.update() except Exception as e: logger.warn('PlexPy failed to update: %s. Restarting.', e) if CREATEPID: logger.info('Removing pidfile %s', PIDFILE) os.remove(PIDFILE) if restart: logger.info('PlexPy is restarting...') exe = sys.executable args = [exe, FULL_PATH] args += ARGS if '--nolaunch' not in args: args += ['--nolaunch'] logger.info('Restarting PlexPy with %s', args) # os.execv fails with spaced names on Windows # https://bugs.python.org/issue19066 if os.name == 'nt': subprocess.Popen(args, cwd=os.getcwd()) else: os.execv(exe, args) os._exit(0)