Systemd#
- class ignis.services.systemd.SystemdService(bus_type: Literal['session', 'system'] = 'session') None #
A service for managing systemd units through DBus.
The default behaviour is to operate on the systemd user bus. To operate on the system bus, use
.get_default("system")
.Example usage:
from ignis.services.systemd import SystemdService systemd_session = SystemdService.get_default() example_unit = systemd_session.get_unit("wluma.service") example_unit.connect("notify::is-active", lambda x, y: print(example_unit.is_active)) systemd_system = SystemdService.get_default("system") system_example_unit = systemd_system.get_unit("sshd.service") system_example_unit.start()
- classmethod get_default(bus_type: Literal['session', 'system'] = 'session') SystemdService #
Returns the default Service object for this process, creating it if necessary.
- Parameters:
bus_type (
Literal
['session'
,'system'
], default:'session'
) -- The bus type.- Return type:
- Bus types:
session: current user session
system: entire system, requires interactive authorization when calling methods
- property units: list[SystemdUnit]#
read-only
A list of all systemd units on the bus.
- get_unit(unit: str) SystemdUnit #
Get
SystemdUnit
by the unit name.- Parameters:
unit (
str
) -- The name of the unit to get.- Return type:
- Returns: