# strict_systemd **Repository Path**: your-own-os/strict_systemd ## Basic Information - **Project Name**: strict_systemd - **Description**: Python module for strictly manipulating systemd. - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 8 - **Created**: 2025-05-26 - **Last Updated**: 2026-03-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # strict_systemd Python module for strictly manipulating systemd. ## Overview This module provides a strict, high-level API for managing systemd unit files and runtime services. It offers two main submodules: - **cfg**: For managing systemd unit files (creating, querying, and manipulating) - **runtime**: For controlling running services (starting, stopping, enabling, disabling) ## Requirements - Linux - Python 3 - SystemdUnitParser (for parsing systemd unit files) ## Usage ### Configuration Module ```python from strict_systemd import cfg # System services sys_cfg = cfg.SysCfgDir() # Query all services services = sys_cfg.query_services() # Create a daemon service daemon_service = sys_cfg.create_service(cfg.ServiceType.DAEMON, sys_cfg.etc_system_dir, name="my-daemon", content="[Unit]\n...") # Get a target target = sys_cfg.get_target(cfg.TargetType.MAIN, name="multi-user.target") ``` ### Runtime Module ```python from strict_systemd import runtime # System services service = runtime.DaemonService(True, name="sshd") # Control service service.start() service.stop() service.enable() service.disable() # Check status print(service.is_running()) print(service.is_enabled()) ``` ## Module Structure ### cfg (Configuration) - `SysCfgDir`: Manages system-wide systemd units (`/etc/systemd/system`, `/usr/lib/systemd/system`) - `UserCfgDir`: Manages user systemd units (`~/.config/systemd/user`, `/etc/systemd/user`, `/usr/lib/systemd/user`) - `MainTarget`: Represents main systemd targets (e.g., multi-user.target, graphical.target) - `AuxillaryTarget`: Represents auxiliary systemd targets - `DaemonService`: Manages daemon services (.service units) - `AutoMountService`: Manages automount units (.automount units) - `MountService`: Manages mount units (.mount units) - `SwapService`: Manages swap units (.swap units) ### runtime (Runtime) Runtime classes wrap configuration classes with runtime control capabilities: - `DaemonService`: Control daemon services at runtime - `AutoMountService`: Control automount services at runtime - `MountService`: Control mount services at runtime - `SwapService`: Control swap services at runtime - `MainTarget`: Control main targets - `AuxillaryTarget`: Control auxiliary targets ## License GNU General Public License v3 (GPLv3)