/linux:linux-service-managementfrom linux
Operates and diagnoses systemd units, timers, targets, journal logs, restart policies, dependencies, and cgroup limits on Linux servers. Covers both Debian/Ubuntu and RHEL families.
Ships in linux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
systemd is identical on both supported families — systemctl, journalctl,
unit files, targets, and timers all work the same. The only differences are a
few unit names and the package manager. The commands below use the
Debian/Ubuntu names; the RHEL family (Fedora, RHEL, CentOS Stream, Rocky,
Alma, Oracle) equivalents are in the matrix.
| Concept | Debian/Ubuntu | RHEL family |
|---|---|---|
| Web server unit | apache2 | httpd |
| Cron daemon unit | cron | crond |
| SSH daemon unit | ssh | sshd |
| Database unit | mysql / mariadb | mariadb |
| Firewall unit | ufw | firewalld |
| Install a service pkg | apt install <pkg> | dnf install <pkg> |
| systemctl / journalctl | identical | identical |
| Unit file locations | /etc/systemd/system, /lib/systemd/system | same |
Targets (multi-user/graphical) | identical | identical |
cgroup v2 resource control (CPUWeight=, CPUQuota=, IOWeight=, MemoryMax=) | identical | identical |
nice / renice / ionice | identical | identical |
In sk-* scripts, resolve unit names with the svc_name helper from
common.sh (e.g. svc_name apache → apache2 or httpd) instead of
hardcoding — see linux-bash-scripting and
docs/multi-distro/plan.md.
systemd services on a Linux server.linux-log-management.linux-troubleshooting.| Artefact | Source | Required? | If absent |
|---|---|---|---|
| Unit name, host family, symptom, timestamp, and expected service behaviour | Incident/change request | required | Use read-only unit discovery; do not guess an alias. |
| Unit definition/drop-ins, status, journal, dependencies, and recent config/package changes | Host and change history | required for diagnosis | Return collection commands and mark root cause unresolved. |
| Change window, health check, and rollback/recovery authority | Service owner | required for reload/restart/edit | Stop before mutation. |
daemon-reload when needed, and returning the service to its last verified state.active (running) as application health. Fix: probe the service's real socket, protocol, or job outcome./usr/lib or /lib. Fix: use a reviewed drop-in and daemon-reload.enable as proof the service is running. Fix: verify enablement and current runtime state separately.| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Unit diagnosis or controlled action | System operator | Names unit/load/active/sub state, failure cause, dependencies, and exact action. |
| Unit/drop-in change record | Reviewer | systemd-analyze verify or service-native config checks pass and rollback is documented. |
| Runtime verification | Service owner | Unit remains stable and its real endpoint/job/timer behaviour succeeds. |
../../docs/continuous-improvement/safe-reversible-operations-standard.md
../../docs/continuous-improvement/incident-learning-standard.md
| Artefact | Acceptance condition |
|---|---|
| Service-management evidence | Includes unit identity/status, journal timeline, dependencies, config validation, before/after properties, action result, and application health. |
Diagnosis defaults to read-only. Read/execute access is required for systemd and journal inspection. Editing units/drop-ins, changing enablement/resource limits, or reloading/restarting a production unit requires explicit authority; masking, stopping critical units, or changing targets needs separate confirmation.
Without host execution, review supplied unit/config/logs and label runtime stability and application health not assessed. Without a service-specific validator, require a documented low-risk test and rollback before reload.
| Choice | Action | Failure or risk avoided |
|---|---|---|
| Config supports reload | Validate then reload | Avoidable connection interruption. |
| Binary/environment/dependency changed | Controlled restart after validation | Old process retaining stale state. |
| Rapid restart loop | Stop retries, inspect first failure and limits | Log flooding and dependency damage. |
When httpd enters a restart loop on AlmaLinux, capture status and first-failure journal entries, inspect overrides and config syntax, correct the evidenced error, reset the failed state only after validation, start once, then verify the HTTP endpoint and absence of renewed failures.
This skill is self-contained. Every command below is a standard systemd
tool that works identically on both the Debian/Ubuntu and RHEL family (Fedora,
RHEL, CentOS Stream, Rocky, Alma, Oracle) — only the unit names in the Distro
support matrix differ. The sk-* scripts in the Optional fast path
section are convenience wrappers — never required.
sudo systemctl status <service> # check status + last log lines
sudo systemctl start|stop|restart <service>
sudo systemctl reload <service> # graceful (not all services support)
sudo systemctl enable|disable <service> # boot behaviour
sudo systemctl is-active <service>
sudo systemctl is-enabled <service>
| Service | Safe reload? | Notes |
|---|---|---|
nginx | Yes | Always run nginx -t first |
apache2 | Yes | Run apache2ctl configtest first |
mysql | No | Brief downtime on restart |
postgresql | Yes | reload re-reads postgresql.conf |
php8.3-fpm | Yes | reload finishes active requests |
redis | No | |
fail2ban | Yes | reload re-reads jail configs |
certbot.timer | — | systemd timer, not a daemon |
cron | No | |
msmtp | — | not a daemon; test with command |
Full per-service operations: references/service-reference.md
sudo journalctl -u <service> -n 50 --no-pager # last 50 lines
sudo journalctl -u <service> -f # follow live
sudo journalctl -u <service> --since "1 hour ago"
sudo journalctl -u <service> -p err --no-pager # errors only
# Step 1: Read exit code and recent logs
sudo systemctl status <service> --no-pager
# Step 2: Get full error context
sudo journalctl -u <service> --since "5 min ago" --no-pager
# Step 3: Test config (web servers)
sudo nginx -t # nginx
sudo apache2ctl configtest # apache2
sudo php-fpm8.3 -t # php-fpm
# Step 4: Check for disk full or port conflicts
df -h
sudo ss -tlnp | grep <port>
sudo systemctl list-units --type=service --state=failed
sudo systemctl list-units --type=service --state=running | \
grep -E "nginx|apache|mysql|postgresql|php|redis|fail2ban"
A background service must never starve the host. systemd runs every service in a cgroup v2 control group, so you can cap its CPU, I/O, and memory.
# Ad-hoc, per-process: nice (CPU) + ionice (disk I/O)
nice -n 10 /usr/local/bin/backup.sh # lower CPU priority (-20 high .. 19 low)
sudo renice -n 10 -p <pid> # re-prioritize a running process
ionice -c 3 /usr/local/bin/backup.sh # idle I/O class — yields the disk
nice -n 19 ionice -c 3 /usr/local/bin/heavy.sh
# Per-service, persistent, kernel-enforced — via the unit [Service] section:
# Nice=10 CPUWeight=20 CPUQuota=50%
# IOSchedulingClass=idle IOWeight=20 MemoryMax=512M TasksMax=64
# Apply a limit to a running service without editing the unit:
sudo systemctl set-property nginx.service CPUQuota=50% MemoryMax=512M
sudo systemctl set-property --runtime mysql.service IOWeight=50 # until reboot
# Inspect effective limits + live usage:
systemctl show nginx.service -p CPUWeight -p CPUQuota -p MemoryMax
systemd-cgtop # top-like per-cgroup usage
CPUWeight=/IOWeight= are relative shares under contention; CPUQuota=/
MemoryMax= are hard ceilings. See
references/resource-control-and-targets.md
for the full directive table and a worked resource-limited service.
Targets are the modern replacement for SysV runlevels — a group of units that defines the system state.
systemctl get-default # current boot target
sudo systemctl set-default multi-user.target # boot headless (no GUI) — server default
sudo systemctl set-default graphical.target # boot into a desktop
sudo systemctl isolate rescue.target # switch state live (single-user repair)
systemctl list-units --type=target # active targets
systemctl list-dependencies multi-user.target # what boots in this target
| Target | Runlevel | Meaning |
|---|---|---|
multi-user.target | 3 | Full system, no GUI — normal server default |
graphical.target | 5 | multi-user plus a graphical login |
rescue.target | 1 | Single-user repair mode |
Dependency ordering in a unit: Wants= (soft) / Requires= (hard) pull a
dependency in; After=/Before= order startup (ordering is separate from
requirement); [Install] WantedBy=multi-user.target is what systemctl enable hooks into to start the service at boot. Details in
references/resource-control-and-targets.md.
# Any Node.js service registered in systemd:
sudo systemctl status <service-name>
sudo journalctl -u <service-name> -n 50 --no-pager
sudo systemctl restart <service-name> # after code update via update-all-repos
For creating a new Node.js systemd unit, see linux-webstack.
Running sudo install-skills-bin linux-service-management installs the
script listed here from this checkout:
| Task | Fast-path script |
|---|---|
| Show or cap a service's CPU/IO/memory limits | sudo sk-service-priority <service> [--cpu-quota 50% --memory-max 512M] |
Service status, journal, timer, cron, and restart procedures use the systemd and cron commands documented above; this checkout does not ship the other wrappers named in older manifests.
This skill installs the following scripts to /usr/local/bin/. To install:
sudo install-skills-bin linux-service-management
| Script | Source | Core? | Purpose |
|---|---|---|---|
| sk-service-priority | scripts/sk-service-priority.sh | no | Show a service's effective cgroup limits (CPUWeight/CPUQuota/IOWeight/MemoryMax/Nice) and live usage; with limit flags, applies them via systemctl set-property (asks first) so a background service can't starve the host. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
systemd, systemctl, journalctl, service-management, linux-server
45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors./linux-auditd-rulesUse when inspecting, designing, testing, persisting, or querying auditd rules for forensic attribution on Debian/Ubuntu or RHEL-family hosts. Covers watches, syscalls, loss, and immutable mode; use linux-file-integrity for drift and linux-benchmark-scanning for scoring./linux-bash-scriptingUse when writing or reviewing portable sk-* Bash scripts for this engine, including common.sh primitives, flags, preview mode, and safety gates; use linux-repo-sync for Git-update behaviour and not for one-off commands./linux-benchmark-scanningUse when running read-only OpenSCAP or Lynis scans, selecting distro-matched profiles, interpreting failures, or drafting remediation on Debian/Ubuntu or RHEL-family hosts. Use linux-auditd-rules for attribution and linux-file-integrity for AIDE drift.npx claudepluginhub peterbamuhigire/linux-skills --plugin linuxOther plugins' skills for the same job