Service / Daemon

Problem

A web server should start when the machine starts and continue running without somebody opening a terminal. If it crashes, we may want it restarted.

Solution — System Service

A service is a program that runs in the background, such as a web server handling incoming requests. On Unix-like systems, a background process like this is called a daemon. A service manager, such as systemd on Linux, can start it at boot, keep it running after users log out, and restart it after a crash when configured to do so.
systemd
   ↓
nginx
   ↓
running in background
If a service fails, you need to see what happened. On Linux systems using systemd, systemd-journald collects service output and system messages in the journal, a log you can filter by service and time to investigate errors and restarts.
Core idea: services let the OS manage long-lived background applications.