systemd-services

Create, manage, and debug systemd services for Linux background daemons.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/timchap/dot-hermes --skill systemd-services-timchap
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: systemd-services
Source: https://github.com/timchap/dot-hermes/tree/main/skills/meta/systemd-services
Command: npx skills add https://github.com/timchap/dot-hermes --skill systemd-services-timchap

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Running background daemons on Linux with systemd involves subtle pitfalls — services silently running as root, git safe.directory deadlocks, interpreter mismatches, and lock files triggering watcher loops — that are hard to diagnose without deep systemd experience. ## Core Features & Use Cases - Unit File Authoring: Provides a battle-tested service file template covering User directives, restart policies, journal logging, and environment variables. - Pitfall Diagnosis: Documents concrete fixes for root+git safe.directory deadlocks, ExecStart interpreter mismatches, pipefail issues in watcher loops, and lock file placement. - User vs System Services: Explains when to use systemctl --user services versus system-wide units, with full command references. - Use Case: You need a file-watcher script to auto-commit config changes and survive reboots. Use this Skill to write the unit file, avoid the root/git deadlock, set up flock-based locking, and verify via journalctl. ## Quick Start Create a systemd service that runs my watcher script on boot as my user, with auto-restart and journal logging.

Frequently Asked Questions about systemd-services

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a systemd service that starts on boot?▼

Write a unit file in /etc/systemd/system/ with [Service] and [Install] sections, then run systemctl daemon-reload, systemctl enable, and systemctl restart. Set WantedBy=multi-user.target in the [Install] section for boot persistence.

Why does my systemd service fail to access a git repo?▼

A service without a User= directive runs as root, and git's safe.directory check blocks root from accessing user-owned repos, returning NOT_A_REPO. Fix it by adding User=<repo-owner> to the unit file and restarting the service.

What is the difference between system and user systemd services?▼

System services live in /etc/systemd/system/, need sudo, and run before login; user services live in ~/.config/systemd/user/ and are managed with systemctl --user without sudo. Use user services for per-login daemons and system services for machine-wide daemons.

Why does my systemd service fail with a Python SyntaxError on a bash script?▼

The ExecStart line is invoking the wrong interpreter, such as running a bash script through python. Check the script's shebang and match ExecStart to it, for example ExecStart=/bin/bash /opt/app/start.sh.

How do I debug a failing systemd service?▼

Use journalctl -u <service> -f to follow logs, journalctl -u <service> --since "10 min ago" for recent output, and systemctl status <service> for state plus recent log lines. Look for NOT_A_REPO, ModuleNotFoundError, or exit-code failures.

Where should lock files go for an inotify file watcher service?▼

Lock files must live outside the watched directory, such as in /tmp, because lock file create and delete events inside the watched tree retrigger the watcher and cause event cascades. Use flock for kernel-level locking that auto-releases on exit.