Browse help topics

Server Management

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.

  • Updated
  • Last reviewed
  • Intermediate
  • About 10 minutes

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

On this page
  1. Step 1: Find the service’s name
  2. Step 2: Check its status
  3. Step 3: Restart it
  4. Restarting SSH safely
  5. How to tell it worked
  6. Troubleshooting
  7. 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. 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

  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. 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

  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.
  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 sudo systemctl restart sshd (CloudLinux, AlmaLinux and other Red Hat family systems) or sudo systemctl restart ssh (Ubuntu, Debian).
  5. 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 (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 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.