How to Restart a Linux Service
Check the service with systemctl status, restart it with sudo systemctl restart, and read its log with journalctl -u if it fails. Restarting the web or database service briefly interrupts your sites, and you should test SSH settings with sshd -t before restarting SSH.
Applies to: Linux Blue Arctic VPS Hosting and Virtual Dedicated Servers (VDS)
On this page
A service is a program that runs in the background, such as the web server, the database or SSH. If one is stuck or has stopped, restarting it often fixes the problem. Most Linux servers manage services with systemctl.
Warning
Restarting the web server or database interrupts your sites for a few seconds, so choose a quiet time if you can. Every VPS and VDS plan comes with Core Managed: we look after the server underneath your applications, such as OS security patches, Imunify360 and the control panel. Inside the server, root is yours. If a service keeps failing, open a support ticket rather than changing its settings.
Some commands show their output in a viewer that stops with (END) or a : at the bottom. Press q to get back to your prompt.
Step 1: Find the service’s name
- Run
systemctl --failed. It lists services that stopped with an error. If the list is empty (it may say0 loaded units listed), nothing has failed. - To see the services that are running or have failed, run
systemctl list-units --type=service.
Both commands only list services. Names vary between systems. Common ones: web server httpd, apache2, nginx or lsws; database mariadb or mysqld; SSH sshd or ssh. If you’re not sure which one you need, open a support ticket.
Step 2: Check its status
- Run
sudo systemctl status NAME, replacing NAME with the service name. This only reads. - The Active line shows
active (running),inactiveorfailed. The last lines are its most recent log messages.
Step 3: Restart it
- Run
sudo systemctl restart NAME. This stops and starts the service. It prints nothing if it worked. - Run
sudo systemctl status NAMEagain to check it.
Tip
If you only edited a service’s settings file, sudo systemctl reload-or-restart NAME applies the change with less interruption when the service supports it.
Restarting SSH safely
If you changed SSH’s port, open a support ticket before you restart: on some newer systems, a port change needs extra steps.
- Stay connected; don’t close your session. It keeps working while SSH restarts.
- Run
sudo sshd -t. This checks SSH’s settings without changing anything. No output means they’re valid. - If it prints an error, don’t restart SSH. Undo your last change to the SSH settings, or open a support ticket with the error text.
- Restart SSH with
sudo systemctl restart sshd(CloudLinux, AlmaLinux and other Red Hat family systems) orsudo systemctl restart ssh(Ubuntu, Debian). - Open a second window and connect again. Close the first window only when the second one works.
How to tell it worked
sudo systemctl status NAME shows active (running), and whatever was broken, such as your website, works again.
Troubleshooting
- The service fails again straight away: read its last 50 log lines with
sudo journalctl -u NAME -n 50. Common causes are a full disk (rundf -h; Use% near 100% means it’s full; see how to fix a full disk), a typo in a settings file, or a port already in use. - “Unit not found”: the name is wrong. Look it up again in Step 1.
- You don’t know whether it’s safe to restart: ask us first, especially for database services.
- Restarts don’t help and the server is slow: see how to check CPU, memory and disk usage.
Still need help?
Open a support ticket from the Client Portal at my.bluearctic.com. Our support page explains how the 24/7 helpdesk works. Include your VPS IP address, the service name, the output of systemctl status NAME and the last lines of journalctl -u NAME. Never include a password or a private key.