System services

This module provides low-level tools for managing system services, using the service command. It supports both upstart services and traditional SysV-style /etc/init.d/ scripts.
See also
fabtools.require.service
See also
fabtools.systemd
fabtools.service.isrunning(_service)[source]
Check if a service is running.
import fabtools if fabtools.service.isrunning(‘foo’): print “Service foo is running!”
**fabtools.service.start(_service
)[source]
Start a service.
import fabtools # Start service if it is not running if not fabtools.service.is_running(‘foo’): fabtools.service.start(‘foo’)
fabtools.service.stop(service)[source]
Stop a service.
import fabtools # Stop service if it is running if fabtools.service.is_running(‘foo’): fabtools.service.stop(‘foo’)
fabtools.service.restart(service)[source]
Restart a service.
import fabtools # Start service, or restart it if it is already running if fabtools.service.is_running(‘foo’): fabtools.service.restart(‘foo’) else: fabtools.service.start(‘foo’)
fabtools.service.reload(service)[source]
Reload a service.
import fabtools # Reload service fabtools.service.reload(‘foo’)
Warning
The service needs to support the
reload operation.
fabtools.service.forcereload(_service)[source]
Force reload a service.
import fabtools # Force reload service fabtools.service.force_reload(‘foo’)
Warning
The service needs to support the
force-reload** operation.