How to Restart Services


Last modified: May 5, 2023

Overview

This document describes several methods to restart the services (often daemons) on your server. Daemons are small processes that run in the background of your server. You may wish to restart a service if, for example, you changed a service’s configuration, or if the service experiences problems.

Important:
  • If you update your hostname in cPanel & WHM version 108 and later, the system temporarily blocks user access to the Calendars and Contacts interface (cPanel » Home » Email » Calendars and Contacts).

  • If you update your hostname in cPanel & WHM version 106 and earlier, the system temporarily blocks user access to the Horde Webmail and Calendars and Contacts interfaces (cPanel » Home » Email » Calendars and Contacts).

The system restores access to these interfaces after the hostname update finishes. For more information, read our Interface Lock Scripts documentation.

Note:
  • Whenever you change the server’s hostname, you must use one of the following methods to ensure that all of the necessary system and service changes occur:

  • If your cPanel & WHM server uses a cloud-based hosting provider, read our Cloud-Hosted Hostname Solution documentation.

Restart services in the WHM interface

Unless problems prevent this, you can restart most services in WHM’s Restart Services interface (WHM » Home » Restart Services).

Restart services from the command line

Important:

If you use IPv6, the service network restart command will remove the IPv6 addresses from the network device. To restart your IPv6 configuration after you run the service network restart command, you must run the /usr/local/cpanel/scripts/restartsrv_cpipv6 command after you restart the network service.

Use the restartsrv script

If a service will not restart from WHM, use the /usr/local/cpanel/scripts/restartsrv_* command to attempt to restart the service from the command line.

When you run this command, replace * with the correct value for that service. For more information, read our The restartsrv Script documentation.

Direct service restart

If the /usr/local/cpanel/scripts/restartsrv_* script does not restart the service, you can attempt to restart the service directly.

For servers that run CloudLinux™ 6, run the following command, where /etc/rc.d/init.d/service is the path to the service:

/etc/rc.d/init.d/service restart

For servers that run CentOS, CloudLinux 7 and later, AlmaLinux OS, Red Hat® Enterprise Linux® (RHEL), or Rocky Linux™, run the following command, where service-name is the service that you wish to restart:

systemctl restart service-name.service

Service error logs

If the restart fails, check the service’s error log for help to diagnose the issue. Because each service logs its errors differently, check the service’s documentation to find the error log’s location.

The following list contains common locations for some service’s error logs:

  • Apache web server — /var/log/apache2/error_log

  • BIND nameserver, ProFTP FTP server, Pure-FTP FTP server — /var/log/messages

  • Exim mail transfer agent (MTA) — /var/log/exim_mainlog, /var/log/exim_rejectlog, /var/log/exim_paniclog

    Warning:

    If the /var/log/exim_paniclog file isn’t empty, Exim has serious problems and will not run on some distributions.

  • Dovecot mail server — /var/log/maillog

  • MySQL database server — /var/lib/mysql/hostname.err

    Note:

    Substitute hostname with your server’s hostname.

  • OpenSSH secure shell service — /var/log/messages, /var/log/secure, /var/log/auth

For more information about these files, read our The cPanel & WHM Log Files documentation.

Additional Documentation