Lesson 11: Services — systemctl and journalctl
We can already find and stop a single process. But servers run services — programs that run in the background all the time (a web server like nginx, SSH, a database), that come up automatically with the machine and restart if they fall. You manage them with systemctl: systemctl status nginx checks i
A service is like a worker always on shift in the background. systemctl is its remote: check if it's working (status), start, stop, or restart it. journalctl is reading its work log.
- service
- A program that runs in the background all the time — a web server, SSH, a database. Comes up automatically with the machine, and is managed by systemd.
- systemctl
- The remote for services. systemctl status nginx checks state, start/stop/restart start/stop/restart it, and enable makes it auto-start at boot. Most actions need sudo.
- journalctl
- Reads a service's logs: journalctl -u nginx shows nginx's log. That's how you understand why a service fell or is misbehaving.
- enable
- systemctl enable nginx makes the service auto-start on every server boot. (start runs it now; enable ensures it comes up in the future too.)