📦 unit-suffix-remover (unsure)
Python CLI to stop, disable, and remove systemd
.timerand.serviceunits by suffix. 🔧🧹
🧭 How it works
flowchart TD
A["unsure -s SUFFIX"] --> B["list *.service and *.timer in the unit dir"]
B --> C{"name is PREFIX.SUFFIX with an optional @INSTANCE?"}
C -- no --> B
C -- yes --> D["collect the unit"]
D --> E{"any unit collected?"}
E -- no --> Y["No matching units found - exit 0"]
E -- yes --> F{"--dry-run?"}
F -- yes --> G["announce the removal, change nothing"]
F -- no --> H["systemctl stop"]
H --> I["systemctl disable"]
I --> J["delete the unit file"]
J --> K["systemctl daemon-reload"]
G --> Z["exit 0"]
K --> Z
🚀 Installation
pip install unit-suffix-remover
pip is the single supported installation path.
The package installs two identical commands: unsure (primary) and usure (kept for older documentation and scripts).
🔧 Requirements
- Python 3.10+ 🐍
systemctlonPATH(systemd)
If systemctl is missing, the command exits with code 127 and a one‑line error instead of a traceback.
⚙️ Usage
unsure -s SUFFIX [--dry-run] [--unit-dir DIR]
-s,--suffix: suffix of unit files to target (e.g.infinitofor*.infinito.timerand*.infinito.service). Required.-d,--dry-run: show actions without executing them.--unit-dir: directory to scan. Defaults to/etc/systemd/system.
Only the exact suffix directly before @ or the extension matches:
| Unit file | -s infinito |
|---|---|
web.infinito.service |
✅ matched |
web.infinito@db.timer |
✅ matched |
web.infinito.nexus.timer |
❌ extra part after the suffix |
web@db.infinito.timer |
❌ suffix sits after @ |
web.infinitoX.service |
❌ suffix is only a prefix |
For full options:
unsure --help
Exit codes
| Code | Meaning |
|---|---|
0 |
Finished, or nothing matched. |
2 |
Invalid command line arguments. |
127 |
A required command is not installed. |
🧪 Development
make lint # ruff check + ruff format --check
make format # apply ruff format
make test # unit + integration tests
make test-unit
make test-integration
make test-e2e # install the package in a container and exercise the CLI
Tests run against the working tree — the Makefile puts src/ on PYTHONPATH, so no install is needed. --unit-dir lets the integration tests work on a temporary directory instead of /etc/systemd/system.
👤 Author
Developed by Kevin Veen‑Birkenbach 🌐 veen.world
📜 License
This project is licensed under the MIT License.
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 unit_suffix_remover-1.0.1.tar.gz.
File metadata
- Download URL: unit_suffix_remover-1.0.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28bfdc182d537677e9cef1b3e039e5cd70046ad6036bdc765045916794b8423d
|
|
| MD5 |
156463da8c011fcf8fa220844f6ee15f
|
|
| BLAKE2b-256 |
32cdf27dcca7a7c5dd0bb80140b84d0cab87716f632f18a57957d603aadf6087
|
File details
Details for the file unit_suffix_remover-1.0.1-py3-none-any.whl.
File metadata
- Download URL: unit_suffix_remover-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c6c1de8cd28935842a438fa8f5ec7b40a0af01ae67a953609a3e0827bd8dc55
|
|
| MD5 |
f1a1ee968250693aed7f433f1b9633f8
|
|
| BLAKE2b-256 |
d79a3c5e04748130eeeef7ab2eb55a19e559d03bc15015b1245b234ba258a769
|