Esempio n. 1
0
def shutdown(restart=False, update=False):

    cherrypy.engine.exit()
    SCHED.shutdown(wait=False)
    config_write()

    if not restart and not update:
        logger.info("LazyLibrarian is shutting down...")
    if update:
        logger.info("LazyLibrarian is updating...")
        try:
            versioncheck.update()
        except Exception as e:
            logger.warn("LazyLibrarian failed to update: %s. Restarting." % e)

    if PIDFILE:
        logger.info("Removing pidfile %s" % PIDFILE)
        os.remove(PIDFILE)

    if restart:
        logger.info("LazyLibrarian is restarting ...")
        popen_list = [sys.executable, FULL_PATH]
        popen_list += ARGS
        if "--nolaunch" not in popen_list:
            popen_list += ["--nolaunch"]
            logger.info("Restarting LazyLibrarian with " + str(popen_list))
        subprocess.Popen(popen_list, cwd=os.getcwd())

    os._exit(0)
Esempio n. 2
0
def shutdown(restart=False, update=False):
    cherrypy.engine.exit()
    SCHED.shutdown(wait=False)
    # config_write() don't automatically rewrite config on exit

    if not restart and not update:
        logger.info('LazyLibrarian is shutting down...')
    if update:
        logger.info('LazyLibrarian is updating...')
        try:
            versioncheck.update()
        except Exception as e:
            logger.warn('LazyLibrarian failed to update: %s. Restarting.' % str(e))

    if PIDFILE:
        logger.info('Removing pidfile %s' % PIDFILE)
        os.remove(PIDFILE)

    if restart:
        logger.info('LazyLibrarian is restarting ...')
        popen_list = [sys.executable, FULL_PATH]
        popen_list += ARGS
        if '--update' in popen_list:
            popen_list.remove('--update')
        if '--nolaunch' not in popen_list:
            popen_list += ['--nolaunch']
            logger.info('Restarting LazyLibrarian with ' + str(popen_list))
        subprocess.Popen(popen_list, cwd=os.getcwd())

    os._exit(0)
Esempio n. 3
0
def shutdown(restart=False, update=False):

    cherrypy.engine.exit()
    SCHED.shutdown(wait=False)
    config_write()

    if not restart and not update:
        logger.info('LazyLibrarian is shutting down...')
    if update:
        logger.info('LazyLibrarian is updating...')
        try:
            versioncheck.update()
        except Exception, e:
            logger.warn('LazyLibrarian failed to update: %s. Restarting.' % e)
Esempio n. 4
0
def shutdown(restart=False, update=False):
    logger.debug(u'Stopping webserver.')
    cherrypy.engine.exit()
    logger.debug(u'Stopping scheduler.')
    SCHED.shutdown(wait=False)
    logger.debug(u'Writing config.')
    config_write()

    if not restart and not update:
        logger.info(u'LazyLibrarian is shutting down...')
    elif update:
        logger.info(u'LazyLibrarian is updating...')
        try:
            from lazylibrarian import versioncheck
            versioncheck.update()
        except Exception, e:
            logger.warn(u'LazyLibrarian failed to update: %s. Restarting.' % e)