Linux Service Troubleshooting: systemctl and journalctl Essentials
When a website stops responding, the first question is often whether its web server, database, or supporting service is still running. On most modern Linux distributions, systemd manages these services. Its two most useful diagnostic tools are systemctl, which shows and changes service state, and journalctl, which retrieves the related logs.
Using them together provides a fast, structured way to find failures without immediately rebooting the server or making unnecessary configuration changes.
Start With the Service Status
Run systemctl status nginx, replacing nginx with the service you need to inspect. The output shows whether the unit is loaded, its current state, the main process ID, recent log entries, and the command used to start it.
A service may be active, inactive, activating, or failed. The command systemctl is-active nginx is useful in scripts because it returns a simple status and an appropriate exit code. To see all units that systemd currently considers failed, use systemctl --failed.
If you are still learning shell administration, our overview of essential Linux commands for website owners provides useful background.
Know When to Restart or Reload
systemctl start nginx starts an inactive service, while stop shuts it down. The restart action stops and starts the service, which may briefly interrupt active connections. Where the application supports it, systemctl reload nginx asks it to reread configuration without a full restart.
Do not confuse this with systemctl daemon-reload. That command makes systemd reread unit files after a unit definition or override has changed; it does not reload the application configuration by itself. Before restarting a web server, run its configuration test command so that a syntax error does not turn a working service into an outage.
Read Focused Logs With journalctl
A failed status tells you what happened, but logs usually explain why. Use journalctl -u nginx to display entries for one unit. Add -b to limit results to the current boot, or --since "30 minutes ago" to focus on the period around an incident.
For live troubleshooting, journalctl -u nginx -f follows new messages as they arrive. You can then reproduce the problem in another terminal and watch for permission errors, invalid configuration, missing files, exhausted resources, or a port already in use.
Our guide to Linux log files for website troubleshooting explains how the system journal fits alongside application-specific access and error logs.
Check Whether the Service Starts at Boot
A service can be running now but still fail to return after a reboot. systemctl is-enabled nginx shows whether it is configured to start automatically. Use systemctl enable nginx when automatic startup is required, or enable --now to enable and start it in one step.
Use a Repeatable Troubleshooting Sequence
First check status, then review unit-specific logs and test the application’s configuration. Confirm listening ports, disk space, permissions, and dependencies before restarting. After recovery, verify that the service is active, enabled when appropriate, and reachable from outside the server.
For detailed service states and supported management commands, consult Red Hat’s official systemd management documentation. This disciplined approach turns a vague “site is down” report into a short series of measurable checks.