Simple libarary for controlling systemd services
Project description
Python-Systemctl-Library
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 pysysctllib
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.properites()
svc.status()
svc.list_dependencies()
svc.unit_file_state()
svc.main_pid()
svc.reload_daemon()
API
Systemctl(service_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
properites() -> dictstatus() -> StatusModelis_active() -> boolmain_pid() -> intunit_file_state() -> strlist_dependencies() -> list
systemd Manager
reload_daemon() -> bool
License
Library use GPL-2.0 License.
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 Distribution
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.1.0.tar.gz.
File metadata
- Download URL: pysysctllib-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4946da738d25d82bff478e98069730e654fb771e08c23fd53659df63201e5f45
|
|
| MD5 |
9ad517e2877793e313177a5358a0c326
|
|
| BLAKE2b-256 |
151642666ef1b8e1bb69908e0412d2a6dc8d4d8186a8e66e83165a684c21dcdf
|
Provenance
The following attestation bundles were made for pysysctllib-0.1.0.tar.gz:
Publisher:
python-publish.yml on Sesdear/Python-Systemctl-Library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysysctllib-0.1.0.tar.gz -
Subject digest:
4946da738d25d82bff478e98069730e654fb771e08c23fd53659df63201e5f45 - Sigstore transparency entry: 2210710306
- Sigstore integration time:
-
Permalink:
Sesdear/Python-Systemctl-Library@02fcbcce5d8a3936bae405205f9f7b9b97b538e4 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Sesdear
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@02fcbcce5d8a3936bae405205f9f7b9b97b538e4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pysysctllib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pysysctllib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f9c165b9e32538c9eeed64cf4c3f730bcadc67b7f3032c9800ec85611e3551b
|
|
| MD5 |
184b83d8e8b14f885c8062db3fd9c979
|
|
| BLAKE2b-256 |
29106b5aa6fe9811d9465fac790b2773c1540bd02e54e4f1ea6694c321946fc6
|
Provenance
The following attestation bundles were made for pysysctllib-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on Sesdear/Python-Systemctl-Library
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysysctllib-0.1.0-py3-none-any.whl -
Subject digest:
9f9c165b9e32538c9eeed64cf4c3f730bcadc67b7f3032c9800ec85611e3551b - Sigstore transparency entry: 2210710326
- Sigstore integration time:
-
Permalink:
Sesdear/Python-Systemctl-Library@02fcbcce5d8a3936bae405205f9f7b9b97b538e4 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/Sesdear
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@02fcbcce5d8a3936bae405205f9f7b9b97b538e4 -
Trigger Event:
release
-
Statement type: