How to Restart a Linux Service
On a server with cPanel/WHM or Plesk, restart the service in the control panel first. Otherwise check it 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. On a server with cPanel/WHM or Plesk, restart it in the control panel first. Otherwise, use the systemctl commands from Step 1 on.
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. Not sure whether the work is covered by your plan? Open the ticket and we’ll tell you.
With a control panel: restart it there first
Warning
Before you restart SSH by any method, read “Restarting SSH safely” below.
cPanel/WHM
- Log in to WHM as root. WHM is the server-wide side of cPanel and has its own web address. If you don’t have that address, open a support ticket or use the commands below.
- Open Restart Services.
- Click the service, for example HTTP Server (Apache) or SQL Server (MySQL).
- When WHM asks if you’re sure, click Yes.
WHM can’t restart a service that has stopped completely. If the service doesn’t restart, connect with SSH as root and run cPanel’s own restart command. Replace NAME with the service, such as httpd (web server), mysql (database) or sshd (SSH):
/usr/local/cpanel/scripts/restartsrv_NAME
If that doesn’t work either, use the systemctl steps below.
Plesk
Go to Tools & Settings → Server Management → Services Management and click the restart icon next to the service.
If you can’t find these screens, open a support ticket or use the steps below.
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. On CloudLinux and other Red Hat family systems: web server httpd, database mariadb or mysqld, SSH sshd. If your server runs Ubuntu or Debian instead: apache2, mariadb or mysql, and ssh. Other web servers have their own names, such as nginx or lsws. 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. If it prints a line that starts withJob forand saysfailed, see Troubleshooting. - 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 cPanel/WHM, click SSH Server (OpenSSH) in Restart Services. Without it, run
sudo systemctl restart sshd(CloudLinux and other Red Hat family systems). If your server runs Ubuntu or Debian instead, the command issudo systemctl restart ssh. - Open a second window and connect again. Close the first window only when the second one works.
- If the second window can’t connect, keep the first one open. Use it to undo your last change to the SSH settings, run
sudo sshd -tagain and restart SSH again. If that doesn’t fix it, leave the first window open and open a support ticket.
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 NAME.service could not be found” or “Unit NAME.service 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.