Services
Programs that run all the time.
Some programs need to run all the time, in the background, without anyone logged in. A web server, a database, a scheduler. These are called services, or daemons.

- Some programs run all the time
- No one needs to be logged in
- Services, or daemons
systemd and systemctl
On most modern Linux systems, a program called system D starts and looks after services. You control it with system CTL. Start and stop a service, restart it after changing its settings, and enable it, so it starts automatically every time the computer boots.
A service, for real
Our practice computer uses the older service command, which works the same way. Service cron status asks whether cron, the task scheduler, is running. It isn't. Sudo service cron start starts it. Now the status says it's running, and P grep finds the cron process.
service cron status * cron is not running sudo service cron start * Starting periodic command scheduler cron ...done. service cron status * cron is running pgrep -l cron 48 cron
Reading service logs
When a service misbehaves, its log tells you why. On system D machines, journal CTL dash U, and the service name, shows its log. Add dash F to follow it live. Many services also write their own log files, in slash var slash log.
| key | value |
|---|---|
| systemctl status x | is it running? |
| journalctl -u x | its log |
| journalctl -u x -f | follow live |
| /var/log | more log files |
Summary
Services run in the background, all the time. System CTL starts, stops, and enables them, and journal CTL shows their logs. Next, rescuing a computer from a runaway process.
Key takeaways- systemctl start / stop
- systemctl enable
- journalctl -u