systemd Services & Logging
Run software as reliable systemd services with timers, resource limits and sandboxing, and investigate them through the journal.
4 objectives 6 steps about 130 min
Check what you know
The lessons are coming later. The knowledge check is ready now.
This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.
Learning objectives
- Write a systemd service unit with dependencies, environment and a restart policy, and manage it with systemctl.
- Start work on a schedule or on demand with timer and socket units, and compare them with cron and always-running daemons.
- Query and filter logs with journalctl, make the journal persistent, and forward or rotate logs for retention.
- Apply resource limits (MemoryMax, CPUQuota, LimitNOFILE and other per-process rlimits) and sandboxing directives (ProtectSystem, NoNewPrivileges, DynamicUser), and verify them with systemd-analyze security and /proc/<pid>/limits.
Lesson plan
6 steps, about 130 min · 0 of 5 lessons available so far
- Units, targets and dependencies: how systemd models a system Concept · 20 min · coming later
- Lab: turn a script into a service that restarts on failure Lab · 25 min · coming later
- Timer and socket units: starting work on a schedule or on demand Worked example · 20 min · coming later
- Lab: reading the journal by unit, priority, boot and time Lab · 20 min · coming later
- Hardening a service: resource limits, open-file limits and sandboxing directives Worked example · 25 min · coming later
- Check: debug a crash-looping service from its unit file and journal Knowledge check · 8 questions
Practise it
Run a small HTTP app as a systemd service under a dynamic user with MemoryMax, a restart policy and sandboxing, add a daily timer that backs up its data, and submit journalctl evidence of a forced crash and automatic restart plus the systemd-analyze security score before and after hardening.
References
Hard prerequisites
None.
Unlocks
On these roadmaps
Progress and evidence for this skill are shared across all of them.