The command is sudo systemctl restart <service>, and on any modern Linux distribution that is the answer for Nginx, Postgres, your app, and almost everything else. But restart is a blunt instrument - it stops the service and starts it again, dropping every in-flight connection in between. For a config change, reload is often the better tool because it re-reads config without the downtime. The reflex to reach for when a service misbehaves is restart, then status to confirm it actually came back - not a reboot of the whole server, which is the sledgehammer people reach for out of habit.
Rebooting the server to restart one service is the Linux equivalent of turning the house’s power off to reset a lamp. It works, and it is almost always the wrong tool.
Table of contents
- The command that covers most cases
- restart vs reload: the distinction that saves downtime
- Always check it came back
- Restarting safely under live traffic
- When you actually do want to reboot
- How this fits the rest of the stack
- FAQ
The command that covers most cases
systemd is the init system on Ubuntu, Debian, RHEL, Fedora, and nearly every current distro, so systemctl is the tool:
sudo systemctl restart nginx
That stops nginx and starts it again. Swap nginx for any unit - postgresql, docker, ssh, your own myapp.service. If you are not sure of the exact unit name, list them:
systemctl list-units --type=service
A restart is a full stop-then-start. Any request being served at the moment you run it is cut off. For a background worker that is usually fine. For a web server with live traffic, it means a brief blip - which is exactly why reload exists.
restart vs reload: the distinction that saves downtime
reload tells a running service to re-read its configuration without stopping. The process keeps its open connections; it just picks up the new config.
sudo systemctl reload nginx
Not every service supports it - reload only works if the program knows how to handle a config refresh (Nginx, Apache, and Postgres do; many small daemons do not). The rule of thumb:
- Changed a config file? Try
reloadfirst. Zero downtime if the service supports it. - The service is wedged, crashed, or leaking? Use
restart- you want a clean process. - Not sure if reload is supported?
systemctl reload-or-restart <service>does the safe thing: reload if it can, restart if it cannot.
Always check it came back
The mistake is running restart and walking away. A service can fail to start - a syntax error in the config you just edited, a port already in use - and restart will not shout about it loudly. Check:
sudo systemctl status nginx
Look for active (running) in green. If you see failed, the config or the environment is broken, and the service is now down, not restarted. The logs tell you why:
sudo journalctl -u nginx --since "5 minutes ago"
Make status a habit right after every restart. Two seconds of checking beats finding out from a monitoring alert - or a customer - that the thing never came back up.
Restarting safely under live traffic
For a service behind a load balancer, a plain restart still drops the connections on that one box during the gap. Better options, in order of preference:
reloadif the service supports it - no gap at all.- Rolling restart across multiple instances - restart one at a time so the others keep serving. This is what an orchestrator does for you.
- Drain first - pull the box out of the load balancer, let in-flight requests finish, then restart, then add it back.
The whole reason platforms and orchestrators exist is to turn “restart the service” into a zero-downtime operation without you scripting the drain-and-rejoin dance by hand every time.
When you actually do want to reboot
Rebooting the whole server is occasionally the right call - but for specific reasons, not as a generic “turn it off and on again”:
- A kernel update that needs the new kernel loaded.
- A system so wedged that individual services will not respond to
systemctlat all. - A change to something that only initialises at boot.
For everything else - a config change, a memory leak, a hung worker - restart the service, not the machine. A reboot takes the whole box offline, restarts every service on it, and can take minutes. Restarting one unit takes a second and touches only what needs touching.
How this fits the rest of the stack
Whatever you decide here, the cost of it eventually shows up as a bill. The RunxBuild hosting calculator is the right place to model that before committing: the compute, the database, the storage, the bandwidth, the worker - each one is a separate line item, and the real cost of a platform is the sum, not the headline number. The RunxBuild dashboard is where the team sees the actual usage once it is running.
Useful related references:
- Restart SSH Service Ubuntu: systemctl, sshd vs ssh, and Reload
- API vs Web Service: The Difference That Matters When You Deploy One
- Application Service Providers: ASP, SaaS, MSP, and the Lineage
- Services on RunxBuild
- Getting started with RunxBuild
FAQ
How do I restart a service in Linux?
Run sudo systemctl restart <service-name>, for example sudo systemctl restart nginx. This stops and starts the service. Follow it with sudo systemctl status <service-name> to confirm it came back up as active (running) rather than failing on a bad config.
What is the difference between restart and reload?
restart fully stops and starts the service, dropping in-flight connections. reload tells a running service to re-read its config without stopping, so there is no downtime - but only services that support it (Nginx, Apache, Postgres) can reload. Use reload for config changes, restart for a wedged process.
How do I restart a service without downtime?
Use systemctl reload if the service supports it, since it re-reads config without stopping. For services that cannot reload, do a rolling restart across multiple instances behind a load balancer, or drain the instance from the balancer before restarting so no live requests are cut off.
How do I check if a service restarted successfully?
Run sudo systemctl status <service> and look for active (running). If it shows failed, the service is down - check why with sudo journalctl -u <service> --since "5 minutes ago". Always verify status after a restart rather than assuming it worked.
Should I reboot the server to restart a service?
Almost never. Rebooting takes the whole machine offline and restarts every service on it, when you usually only need to restart one. Reboot only for a kernel update, a fully wedged system, or a change that initialises solely at boot. Otherwise restart the specific service.