SystemCtl

class systemctl.SystemCtl(service_name=None)[source]

Bases: object

disable()[source]

Disable the service.

Returns:

The exit code of the systemctl command.

Return type:

int

enable()[source]

Enable the service.

Returns:

The exit code of the systemctl command.

Return type:

int

enabled()[source]
Returns:

Whether or not the service is enabled.

Return type:

bool

installed()[source]
Returns:

Whether the service is present at all.

Return type:

bool

pid()[source]
Returns:

The PID of the running service.

Return type:

int

restart()[source]

Restart a service.

Returns:

The exit code of the systemctl command.

Return type:

int

running()[source]
Returns:

Whether or not the service is running.

Return type:

bool

service_name(service_name=None)[source]

Get/Set the service_name.

Param:

Optional service name.

Type:

str

Returns:

The service name.

Return type:

str

start()[source]

Start a systemd service.

Returns:

The exit code of the systemctl command.

Return type:

int

stderr()[source]
Returns:

The raw STDERR of a ‘systemctl status service_name’ command.

Return type:

str

stdout()[source]
Returns:

The raw STDOUT of a ‘systemctl status service_name’ command.

Return type:

str

stop()[source]

Stop a systemd service.

Returns:

The exit code of the systemctl command.

Return type:

int

timeout(timeout=None)[source]
Param:

Optional timeout value for the systemctl command.

Type:

int

Returns:

The timeout value.

Return type:

int