Esempio n. 1
0
File: misc.py Progetto: EQ4/DRR
def shutdown_real(do_restart=False):
  # During a restart shutdown we just kill the webserver.
  # The other processes will die off later.
  if 'webserver' in pid_map:
    os.kill(pid_map['webserver'].pid, signal.SIGUSR1)

  if not do_restart:
    for key, value in pid_map.items():
      try:
        value.terminate()
      except:
        pass

    title = SP.getproctitle()
    logging.info("[%s:%d] Shutting down" % (title, os.getpid()))
    DB.shutdown()

    logging.info("Uptime: %ds", TS.uptime())

    if os.path.isfile(PIDFILE_MANAGER):
      os.unlink(PIDFILE_MANAGER)

    sys.exit(0)
Esempio n. 2
0
File: misc.py Progetto: EQ4/DRR
def shutdown_real(do_restart=False):
    # During a restart shutdown we just kill the webserver.
    # The other processes will die off later.
    if 'webserver' in pid_map:
        os.kill(pid_map['webserver'].pid, signal.SIGUSR1)

    if not do_restart:
        for key, value in pid_map.items():
            try:
                value.terminate()
            except:
                pass

        title = SP.getproctitle()
        logging.info("[%s:%d] Shutting down" % (title, os.getpid()))
        DB.shutdown()

        logging.info("Uptime: %ds", TS.uptime())

        if os.path.isfile(PIDFILE_MANAGER):
            os.unlink(PIDFILE_MANAGER)

        sys.exit(0)
Esempio n. 3
0
           += ThreadExceptionEventHandler(exception_handler)

        # fire up the localization/internationalization system
        i18n.install(ComicRack)

        # see if we're in a valid environment
        if __validate_environment():
            delegate()

    except Exception, ex:
        log.handle_error(ex)

    finally:

        # shut down our database connection
        db.shutdown()

        # shut down the localization/internationalization system
        i18n.uninstall()

        # make sure the Winform exception handler is removed
        Application.ThreadException -=\
           ThreadExceptionEventHandler(exception_handler)

        # shut down the logging system
        log.uninstall()


# ============================================================================
def __validate_environment():
    '''
         += ThreadExceptionEventHandler(exception_handler)
         
      # fire up the localization/internationalization system
      i18n.install(ComicRack)
      
      # see if we're in a valid environment
      if __validate_environment():
         delegate()
         
   except Exception, ex:
      log.handle_error(ex)
         
   finally:
      
      # shut down our database connection
      db.shutdown()
      
      # shut down the localization/internationalization system
      i18n.uninstall()
      
      # make sure the Winform exception handler is removed
      Application.ThreadException -=\
         ThreadExceptionEventHandler(exception_handler)
         
      # shut down the logging system
      log.uninstall()


      
# ============================================================================      
def __validate_environment():