def activate(): config = ServicesConfig("services") if config.disabled: logger.warning("Plugin services: disabled by configuration.") return False logger.debug("Loading systemd units") try: ServiceManager().list() except NameError: logger.error( "Failed to list systemd units. Is python-systemd-dbus installed ?") return False try: from mmc.plugins.dashboard.manager import DashboardManager from mmc.plugins.services.panel import ServicesPanel, SystemPanel DM = DashboardManager() DM.register_panel(ServicesPanel("services")) DM.register_panel(SystemPanel("system")) except ImportError: pass return True
def list(): return ServiceManager().list()
def status(service): return ServiceManager().status(service)
def reload(service): return ServiceManager().reload(service)
def restart(service): return ServiceManager().restart(service)
def stop(service): return ServiceManager().stop(service)
def start(service): return ServiceManager().start(service)
def server_reboot(): return ServiceManager().m.reboot()
def server_power_off(): return ServiceManager().m.power_off()
def log(service="", filter=""): return ServiceManager().log(service, filter)
def list_others_services(filter=None): return ServiceManager().list_others_services(filter)
def has_inactive_plugins_services(): return ServiceManager().has_inactive_plugins_services()
def list_plugins_services(): return ServiceManager().list_plugins_services()