def start(config, args): """Start Glances""" # Load mode global mode if core.is_standalone(): from glances.standalone import GlancesStandalone as GlancesMode elif core.is_client(): if core.is_client_browser(): from glances.client_browser import GlancesClientBrowser as GlancesMode else: from glances.client import GlancesClient as GlancesMode elif core.is_server(): from glances.server import GlancesServer as GlancesMode elif core.is_webserver(): from glances.webserver import GlancesWebServer as GlancesMode # Init the mode logger.info("Start {} mode".format(GlancesMode.__name__)) mode = GlancesMode(config=config, args=args) # Start the main loop mode.serve_forever() # Shutdown mode.end()
def start(config, args): """Start Glances.""" # Load mode global mode start_duration = Counter() if core.is_standalone(): from glances.standalone import GlancesStandalone as GlancesMode elif core.is_client(): if core.is_client_browser(): from glances.client_browser import GlancesClientBrowser as GlancesMode else: from glances.client import GlancesClient as GlancesMode elif core.is_server(): from glances.server import GlancesServer as GlancesMode elif core.is_webserver(): from glances.webserver import GlancesWebServer as GlancesMode # Init the mode logger.info("Start {} mode".format(GlancesMode.__name__)) mode = GlancesMode(config=config, args=args) # Start the main loop logger.debug("Glances started in {} seconds".format(start_duration.get())) mode.serve_forever() # Shutdown mode.end()