Exemple #1
0
 def shutdown(signum, frame, signum_set=set()):
     Lifetime.shutdown(0)
     signum_set.add(signum)
     if node_pid_list is None and len(signum_set) > 1:
         # in case of ^C, a child should also receive a SIGHUP from the parent,
         # so we merge the first 2 different signals in a single exception
         signum_set.remove(signal.SIGHUP)
     else:
         raise KeyboardInterrupt
Exemple #2
0
 def shutdown(signum, frame, signum_set=set()):
   Lifetime.shutdown(0)
   signum_set.add(signum)
   if node_pid_list is None and len(signum_set) > 1:
     # in case of ^C, a child should also receive a SIGHUP from the parent,
     # so we merge the first 2 different signals in a single exception
     signum_set.remove(signal.SIGHUP)
   else:
     raise KeyboardInterrupt
 def manage_shutdown(self, REQUEST=None):
     """Shut down the application"""
     try:
         user = '******' % getSecurityManager().getUser().getUserName()
     except:
         user = '******'
     logger.info("Shutdown requested by %s" % user)
     #for db in Globals.opened: db.close()
     Lifetime.shutdown(0)
     return """<html>
Exemple #4
0
 def manage_shutdown(self, REQUEST=None):
     """Shut down the application"""
     try:
         user = '******' % getSecurityManager().getUser().getUserName()
     except:
         user = '******'
     LOG.info("Shutdown requested by %s" % user)
     #for db in Globals.opened: db.close()
     Lifetime.shutdown(0)
     return """<html>
Exemple #5
0
 def manage_restart(self, URL1, REQUEST=None):
     """Shut down the application"""
     try:
         user = '******' % getSecurityManager().getUser().getUserName()
     except:
         user = '******'
     LOG.info("Restart requested by %s" % user)
     #for db in Globals.opened: db.close()
     Lifetime.shutdown(1)
     return """<html>
     <head><meta HTTP-EQUIV=REFRESH CONTENT="10; URL=%s/manage_main">
     </head>
     <body>Zope is restarting</body></html>
     """ % escape(URL1, 1)
 def manage_restart(self, URL1, REQUEST=None):
     """Shut down the application"""
     try:
         user = '******' % getSecurityManager().getUser().getUserName()
     except:
         user = '******'
     logger.info("Restart requested by %s" % user)
     #for db in Globals.opened: db.close()
     Lifetime.shutdown(1)
     return """<html>
     <head><meta HTTP-EQUIV=REFRESH CONTENT="10; URL=%s/manage_main">
     </head>
     <body>Zope is restarting</body></html>
     """ % escape(URL1, 1)
    def signalHandler(self, signum, frame):
        """Meta signal handler that dispatches to registered handlers."""
        signame = get_signal_name(signum)
        logger.info("Caught signal %s" % signame)

        for handler in self.registry.get(signum, []):
            # Never let a bad handler prevent the standard signal
            # handlers from running.
            try: handler()
            except SystemExit, rc:
                # On Unix, signals are delivered to the main thread, so a 
                # SystemExit does the right thing.  On Windows, we are on
                # our own thread, so throwing SystemExit there isn't a great
                # idea.  Just shutdown the main loop.
                logger.debug("Trapped SystemExit(%s) - doing Lifetime shutdown" % (rc,))
                Lifetime.shutdown(rc)
            except:
Exemple #8
0
    def signalHandler(self, signum, frame):
        """Meta signal handler that dispatches to registered handlers."""
        signame = get_signal_name(signum)
        logger.info("Caught signal %s" % signame)

        for handler in self.registry.get(signum, []):
            # Never let a bad handler prevent the standard signal
            # handlers from running.
            try:
                handler()
            except SystemExit, rc:
                # On Unix, signals are delivered to the main thread, so a
                # SystemExit does the right thing.  On Windows, we are on
                # our own thread, so throwing SystemExit there isn't a great
                # idea.  Just shutdown the main loop.
                logger.debug(
                    "Trapped SystemExit(%s) - doing Lifetime shutdown" %
                    (rc, ))
                Lifetime.shutdown(rc)
            except:
Exemple #9
0
def ERP5Site_restartZopeInstance(self):
    """
    Zope must be restart after update the Products or Software
    But the restart into one activity, will make the activity always
    fail and with the server will be restart many times.

    This method use a flag to define if the server was already restarted.
    If yes, the flag is removed and the restart will be ignored.

    This method should be run into a single activity to prevent rollback
    other parts.
  """
    import Lifetime
    Lifetime.shutdown(1, fast=1)
    log("Zope Restart was launched.")

    active_result = ActiveResult()
    active_result.edit(summary="Zope Restart",
                       severity=0,
                       detail="Zope was restart Sucessfully.")
    return active_result
def ERP5Site_restartZopeInstance(self):
  """
    Zope must be restart after update the Products or Software
    But the restart into one activity, will make the activity always
    fail and with the server will be restart many times.

    This method use a flag to define if the server was already restarted.
    If yes, the flag is removed and the restart will be ignored.

    This method should be run into a single activity to prevent rollback
    other parts.
  """
  import Lifetime
  Lifetime.shutdown(1,fast=1)
  log("Zope Restart was launched.")

  active_result = ActiveResult()
  active_result.edit(summary="Zope Restart",
                     severity=0,
                     detail="Zope was restart Sucessfully.")
  return active_result
Exemple #11
0
def restartHandler():
    """Restart cleanly on SIGHUP. This is registered first, so it
       should be called after all other SIGHUP handlers."""
    logger.info("Restarting")
    Lifetime.shutdown(1)
Exemple #12
0
def shutdownFastHandler():
    """Shutdown cleanly on SIGTERM. This is registered first,
       so it should be called after all other handlers."""
    logger.info("Shutting down fast")
    Lifetime.shutdown(0,fast=1)
Exemple #13
0
def restartHandler():
    """Restart cleanly on SIGHUP. This is registered first, so it
       should be called after all other SIGHUP handlers."""
    logger.info("Restarting")
    Lifetime.shutdown(1)
Exemple #14
0
def shutdownFastHandler():
    """Shutdown cleanly on SIGTERM. This is registered first,
       so it should be called after all other handlers."""
    logger.info("Shutting down fast")
    Lifetime.shutdown(0, fast=1)
Exemple #15
0
 def tearDown(self):
     Lifetime.shutdown(0, fast=1)