Simple libary for control status of systemctl service
Project description
Python-Systemctl-Libary
Python library providing a direct interface to systemd via systemctl for service management and inspection.
The library exposes a single high-level class, Systemctl, mapping one-to-one to common systemctl operations and queries.
Installation
From PyPI:
pip install python-systemctl-libary
From source:
git clone https://github.com/Sesdear/Python-Systemctl-Libary.git
cd Python-Systemctl-Libary
pip install .
Environment
- Python >= 3.7
- Linux with systemd
systemctlavailable- Appropriate privileges for service control
Basic Usage
from pysysctllib import Systemctl
svc = Systemctl("nginx.service")
svc.start()
svc.stop()
svc.restart()
svc.reload()
svc.enable()
svc.disable()
svc.mask()
svc.unmask()
svc.is_active()
svc.is_enabled()
svc.is_masked()
svc.status()
svc.get_main_pid()
svc.get_description()
svc.get_unit_file_state()
svc.list_dependencies()
svc.reload_daemon()
API
Systemctl(name: str)
Service unit controller bound to a specific systemd unit name.
Lifecycle Operations
start() -> boolstop() -> boolrestart() -> boolreload() -> bool
Enablement
enable() -> booldisable() -> boolis_enabled() -> bool
Masking
mask() -> boolunmask() -> boolis_masked() -> bool
State and Metadata
status() -> stris_active() -> boolget_main_pid() -> intget_description() -> strget_unit_file_state() -> strlist_dependencies() -> list
systemd Manager
reload_daemon() -> bool
License
GPL-2.0
Author
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysysctllib-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pysysctllib-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60f237e98407df850c143c637576ba721d77fdde9ef1ff11185d6171e847f632
|
|
| MD5 |
26fc252b653d3ec0666c5fae9bd2d17d
|
|
| BLAKE2b-256 |
3e63d4bf76fde0b7af8c2d40ca3fd2abd13a4665bf02aa20518c1970100d255d
|