Quiz: systemd¶
4 questions
L0 (2 questions)¶
1. How do you check why a service failed to start?
Show answer
journalctl -u2. What are the main systemd unit types and when do you use each?
Show answer
service: long-running daemons (nginx, postgresql). timer: scheduled tasks (replaces cron). socket: socket-activated services (on-demand start). target: groups of units (multi-user.target replaces runlevels). mount/automount: filesystem mounts. path: trigger on file/directory changes. slice: resource control grouping (cgroups). Most daily work involves .service and .timer units.L1 (1 questions)¶
1. How do you troubleshoot a systemd service that keeps restarting?
Show answer
1. systemctl status2. journalctl -u
3. Check Restart= and RestartSec= in the unit file (systemctl cat
4. Check resource limits: LimitNOFILE, MemoryMax.
5. Run the binary manually to reproduce.
6. Check for dependency failures: systemctl list-dependencies
L2 (1 questions)¶
1. How do you create a systemd timer to replace a cron job?