Linux Labs

Packages, services, and logs / Stage 6 of 13

Services under systemd

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • systemd reads how to start a service in its unit file: ExecStart is the program, Restart says whether to start it again after a crash. systemctl cat prints the file.
  • sudo journalctl -u <service> prints a service's journal: it shows how the process ended and whether systemd started the service again.
  • The service's main process is Main PID in systemctl status. restart replaces it with a new one; reload keeps it and asks the service to reread its settings.
  • At the start of the lesson cron came back by itself: its unit has Restart=on-failure. The nginx unit has no Restart line, so it stayed failed until a command started it.
Ubuntu 24.04
Loading…