Daemon

class plinth.daemon.Daemon(component_id, unit, strict_check=False, listen_ports=None)[source]

Component to manage a background daemon or any systemd unit.

__init__(component_id, unit, strict_check=False, listen_ports=None)[source]

Initialize a new daemon component.

‘component_id’ must be a unique string across all apps and components of a app. Conventionally starts with ‘daemon-‘.

‘unit’ must the name of systemd unit that this component should manage.

‘listen_ports’ is a list of tuples. Each tuple contains the port number as integer followed by a string with one of the values ‘tcp4’, ‘tcp6’, ‘tcp’, ‘udp4’, ‘udp6’, ‘udp’ indicating the protocol that the daemon listens on. This information is used to run diagnostic tests.

diagnose()[source]

Check if the daemon is running and listening on expected ports.

See plinth.app.Component.diagnose().

disable()[source]

Run operations to disable the daemon/unit.

enable()[source]

Run operations to enable the daemon/unit.

is_enabled()[source]

Return if the daemon/unit is enabled.

is_running()[source]

Return whether the daemon/unit is running.