Exemple #1
0
	def name(self):
		if System.init_system() == "systemd":
			bus = SystemdDbus()
			if self.instances and bus.unit_path_from_pid(self.instances[0].pid):
				if not bus.has_service_property_from_pid(self.instances[0].pid,'PAMName'):
					Id = bus.get_unit_property_from_pid(self.instances[0].pid,'Id')
					if Id and re.search("\.service$", Id):
						return re.sub('\.service$', '', Id)
		if self.is_interpreted:
			return self.instances[0].real_name
		return self._attributes["name"]
Exemple #2
0
    def _helper(app):
        if app.type == Applications.TYPES["DAEMON"]:
            if System.init_system() == "systemd":
                return "systemctl restart {0}".format(app.name)
            else:
                return "service {0} restart".format(app.name)

        elif app.type == Applications.TYPES["STATIC"]:
            return _("You will have to reboot your computer")

        elif app.type == Applications.TYPES["SESSION"]:
            return _("You will have to log out & log in again")

        return None
Exemple #3
0
	def _helper(app):
		if app.type == Applications.TYPES["DAEMON"]:
			if System.init_system() == "systemd":
				return "systemctl restart {0}".format(app.name)
			else:
				return "service {0} restart".format(app.name)

		elif app.type == Applications.TYPES["STATIC"]:
			return _("You will have to reboot your computer")

		elif app.type == Applications.TYPES["SESSION"]:
			return _("You will have to log out & log in again")

		return None
Exemple #4
0
	def render_system(self):
		uptime = datetime.now() - datetime.fromtimestamp(System.boot_time())
		uptime = str(uptime).split('.')[0]

		users = set([user.name for user in psutil.get_users()])
		package_managers = System.package_manager().names()

		view = SystemView()
		view.assign('python', System.python_version())
		view.assign('distribution', System.distribution())
		view.assign('package_managers', package_managers)
		view.assign('init', System.init_system())
		view.assign('uptime', uptime)
		view.assign('user', System.user())
		view.assign('users', users)
		view.assign('version', __version__)
		view.assign('rules_count', len(Rules.all()))
		view.assign('applications_count', len(Applications.all()))
		view.render()
Exemple #5
0
    def render_system(self):
        uptime = datetime.now() - datetime.fromtimestamp(System.boot_time())
        uptime = str(uptime).split('.')[0]

        users = set([user.name for user in psutil.get_users()])
        package_managers = System.package_manager().names()

        view = SystemView()
        view.assign('python', System.python_version())
        view.assign('distribution', System.distribution())
        view.assign('package_managers', package_managers)
        view.assign('init', System.init_system())
        view.assign('uptime', uptime)
        view.assign('user', System.user())
        view.assign('users', users)
        view.assign('version', __version__)
        view.assign('rules_count', len(Rules.all()))
        view.assign('applications_count', len(Applications.all()))
        view.render()
Exemple #6
0
 def is_service(self):
     if System.init_system() == "systemd":
         return SystemdDbus().unit_path_from_id("{0}.service".format(
             self.name))
Exemple #7
0
	def is_service(self):
		if System.init_system() == "systemd":
			return SystemdDbus().unit_path_from_id("{0}.service".format(self.name))