Exemplo n.º 1
0
    def cleanUp(self):
        """
        function call before shutdown of reactor
        """
        logger.info('mmc-agent shutting down, cleaning up...')
        l = AuditFactory().log(u'MMC-AGENT', u'MMC_AGENT_SERVICE_STOP')
        l.commit()

        self.cleanPid()
Exemplo n.º 2
0
        logger.info("Using Python Twisted %s" % twisted.copyright.version)

        logger.debug("Running as euid = %d, egid = %d" %
                     (os.geteuid(), os.getegid()))
        if self.config.multithreading:
            logger.info(
                "Multi-threading enabled, max threads pool size is %d" %
                self.config.maxthreads)
            reactor.suggestThreadPoolSize(self.config.maxthreads)

        # Export the MMC-AGENT variable in the environement so that
        # child process can know they were spawned by mmc-agent
        os.environ["MMC_AGENT"] = VERSION

        # Start audit system
        l = AuditFactory().log(u'MMC-AGENT', u'MMC_AGENT_SERVICE_START')

        # Ask PluginManager to load MMC plugins
        pm = PluginManager()
        code = pm.loadPlugins()
        if code:
            return code

        try:
            self.startService(pm.plugins)
        except Exception, e:
            # This is a catch all for all the exception that can happened
            logger.exception("Program exception: " + str(e))
            return 1

        l.commit()