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.isrunning(_service)[source]
Check if a service is running.
if fabtools.systemd.isrunning(‘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.startand_enable(_service)[source]
Start and enable a service (convenience function).
Note
This function is idempotent.
fabtools.systemd.stopand_disable(_service)[source]
Stop and disable a service (convenience function).
Note**
This function is idempotent.