Restart services from the command line – Cpanel

This document describes several methods to restart the services (often daemons) on your server.

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 appropriate command for your version of cPanel & WHM:
– For cPanel & WHM version 11.52 and earlier, run the /etc/init.d/cpipv6 restart command after you restart the network service.
– For cPanel & WHM version 54 and later, run the /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 https://documentation.cpanel.net/display/ALD/WHM+Scripts WHM Scripts 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 CentOS, CloudLinux™, Red Hat® Enterprise Linux (RHEL) 6, or Amazon Linux, 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 7, CloudLinux 7, or RHEL 7, run the following command, where service-name is the service that you wish to restart:

#systemctl restart service-name.service