Browse help topics

Server Management

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.

  • Updated
  • Last reviewed
  • Intermediate
  • About 10 minutes

Applies to: Linux Blue Arctic VPS Hosting and Virtual Dedicated Servers (VDS)

On this page
  1. With a control panel: restart it there first
  2. cPanel/WHM
  3. Plesk
  4. Step 1: Find the service’s name
  5. Step 2: Check its status
  6. Step 3: Restart it
  7. Restarting SSH safely
  8. How to tell it worked
  9. Troubleshooting
  10. Still need help?

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

  1. 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.
  2. Open Restart Services.
  3. Click the service, for example HTTP Server (Apache) or SQL Server (MySQL).
  4. 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

  1. Run systemctl --failed. It lists services that stopped with an error. If the list is empty (it may say 0 loaded units listed), nothing has failed.
  2. 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

  1. Run sudo systemctl status NAME, replacing NAME with the service name. This only reads.
  2. The Active line shows active (running), inactive or failed. The last lines are its most recent log messages.

Step 3: Restart it

  1. Run sudo systemctl restart NAME. This stops and starts the service. It prints nothing if it worked. If it prints a line that starts with Job for and says failed, see Troubleshooting.
  2. Run sudo systemctl status NAME again 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.

  1. Stay connected; don’t close your session. It keeps working while SSH restarts.
  2. Run sudo sshd -t. This checks SSH’s settings without changing anything. No output means they’re valid.
  3. 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.
  4. 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 is sudo systemctl restart ssh.
  5. Open a second window and connect again. Close the first window only when the second one works.
  6. 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 -t again 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 (run df -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.

Was this article helpful?

Report outdated instructions or suggest an improvement
Type of report

Please do not include passwords or personal information.

Still need help?

Our support team can look into your account and walk you through it.