Services & Supervision
Most important commands to remember
systemctl status UNIT— inspect a service’s current state.journalctl -u UNIT— read journal entries associated with that service.
Commands and flags
These commands appear in the short example below.
| Command or option | Meaning |
|---|---|
systemctl status systemd-journald.service --no-pager |
Show the journal service’s current status directly in the terminal. --no-pager avoids an interactive viewer. |
journalctl -u systemd-journald.service -n 10 --no-pager |
-u selects the unit; -n 10 shows its latest ten available entries. |
UNIT means a systemd unit name. Here we inspect systemd-journald.service, Ubuntu’s journal service. These commands neither stop it nor change its configuration.
The concepts that matter
1. A service has a managed identity beyond one process
A service provides a function, often in the background. Its application code runs in one or more processes. A service manager starts and stops it; Ubuntu normally uses systemd.
Systemd describes a service through a named unit, usually ending in .service. The name identifies what is managed. Its current main process has a PID, which normally changes when a replacement starts. The unit name can stay the same across those replacements.
2. Supervision follows a policy
A supervisor watches the process lifecycle and can respond to an exit. A configured restart policy might replace a process after failure; restarting is not automatic for every service or every exit.
Restarting can recover from a temporary problem, but repeated failures can produce a crash loop. A new PID does not mean the original cause was fixed. Restart delays and start-rate limits help control repeated attempts.
An intentional stop through the service manager is different from terminating a PID directly. The latter can trigger replacement under the restart policy. Use the service manager when your intent is to stop the service itself.
3. Running now and starting at boot are different
In service status, active means the service is running now. Enabled usually means systemd is configured to start it automatically when the system reaches a particular stage during boot. Enabling a service does not necessarily start it immediately, while starting it now does not configure it for future boots.
Disabled does not mean that a service is forbidden to run. It means the service is not configured to start through its usual enablement links. It can still be running because a user, another unit, a timer, or a socket started it. Static means the unit cannot be enabled by itself, but another unit can still start it as a dependency.
Even active (running) is not an application health check. The process could be waiting indefinitely or failing requests. Some successful one-shot services can show active (exited) with no long-running process.
4. Status shows now; logs explain the sequence
systemctl status combines current state with a small recent log excerpt. journalctl lets you examine recorded events for the unit, including startup messages and failures.
Read timestamps and messages in order. An application error before a restart can explain more than the fact that a replacement is running now. journalctl shows only entries that were recorded, retained, matched by your filters, and are visible to your user. An empty result can therefore mean that no matching event was logged, that older entries were removed, or that you do not have permission to view them.
One small example
Optional: run these commands on an Ubuntu VM with systemd:
systemctl status systemd-journald.service --no-pager
journalctl -u systemd-journald.service -n 10 --no-pager
In status, find the unit name, Loaded information, Active state, and Main PID if present. Loaded describes the unit definition and may include an enablement state such as static. The PID identifies its current main process, not the service’s permanent identity.
Then read the journal timestamps and messages. These are entries associated with the journal service itself, not all application logs it collects. Your states, PIDs, and messages will vary. An inactive service can make the status command return nonzero; a permissions notice or no entries may reflect limited journal access.
This example observes an existing service. It creates no unit, triggers no restart, and needs no cleanup.
Keep this idea: manage the service by its unit name, inspect its current state, and use logs to understand how it got there.