This package allows controlling Linux services.
There are three common init systems in use by Linux distributions, each offering its own way to manage system services.
- "System V" (pronounced "system five") is the older init system.
Its service configuration files ("init scripts") are in
/etc/init.dand services are controlled with theservicecommand. - Upstart is a newer init system. Its service configuration files are in
/etc/initand services are controlled by commands such asstart <service>,stop <service>, etc. Normally, distributions that use Upstart as the init system also support managing services using the System V service configuration and commands. - systemd offers an even newer init system. Its service configuration files
are in several locations such as
/usr/lib/systemd/systemand services are controlled by thesystemctlcommand.
This package supports controlling services with either System V commands or systemd commands.
Supported operating systems:
- Ubuntu
- RedHat based distributions such as RHEL, CentOS, and Oracle Linux
- SUSE based distributions such as SLES or SLED
Depending on the operating system distribution and version, instantiate the correct class:
- Ubuntu version<15.04 -
UbuntuInitService - SUSE version<12 -
SuseInitService - RedHat version<7 -
RedHatInitService - Ubuntu version>=15.04 -
SystemdService - SUSE version>=12 -
SystemdService - RedHat version>=7 -
SystemdService
Pass the service name and the name of the process the service is expected to use, for example:
sysv_service = UbuntuInitService('multipath-tools', 'multipathd')
The classes provide the following methods:
is_runningstartforce_startstopis_auto_startset_auto_start
To run this code from the repository for development purposes, run the following:
easy_install -U infi.projector
projector devenv build
Python 3 support is experimental and not fully tested.