fabtools.systemd

Systemd services

This module provides low-level tools for managing systemd services.

See also

fabtools.service

fabtools.systemd.enable(service)[source]

Enable a service.

fabtools.enable('httpd')

Note

This function is idempotent.

fabtools.systemd.disable(service)[source]

Disable a service.

fabtools.systemd.disable('httpd')

Note

This function is idempotent.

fabtools.systemd.is_running(service)[source]

Check if a service is running.

if fabtools.systemd.is_running('httpd'):
    print("Service httpd is running!")
fabtools.systemd.start(service)[source]

Start a service.

if not fabtools.systemd.is_running('httpd'):
    fabtools.systemd.start('httpd')

Note

This function is idempotent.

fabtools.systemd.stop(service)[source]

Stop a service.

if fabtools.systemd.is_running('foo'):
    fabtools.systemd.stop('foo')

Note

This function is idempotent.

fabtools.systemd.restart(service)[source]

Restart a service.

if fabtools.systemd.is_running('httpd'):
    fabtools.systemd.restart('httpd')
else:
    fabtools.systemd.start('httpd')
fabtools.systemd.reload(service)[source]

Reload a service.

fabtools.systemd.reload('foo')

Warning

The service needs to support the reload operation.

fabtools.systemd.start_and_enable(service)[source]

Start and enable a service (convenience function).

Note

This function is idempotent.

fabtools.systemd.stop_and_disable(service)[source]

Stop and disable a service (convenience function).

Note

This function is idempotent.