Valid for versions 100 through the latest version
Last modified: July 28, 2022
Overview
The /usr/local/cpanel/scripts/restartsrv script restarts a service. If a service wont restart from WHM, use this script to restart a service from the command line.
Run the script
To run this script on the command line, use the following format, where service is the services name:
/usr/local/cpanel/scripts/restartsrv_service
Options
Some options my be unavailable for certain services.
Use the following options with this script:
| Options | Description | Example |
|---|---|---|
check |
Checks whether the service is running. | --check |
graceful |
Gracefully restart the service. | --graceful |
hard |
Perform a hard stop and restart for the service. | --hard |
notconfigured-ok |
The unconfigured service will exit with a non-fatal error. | --notconfigured-ok |
reload |
Reload the service. | --reload |
restart |
Perform a soft restart for the service. | --restart |
start |
Start the service. | --start |
stop |
Stop the service. | --stop |
help |
Display the scripts help documentation. | --help |
Services
This script restarts the following services:
apacheorhttpdThe Apache® web server daemon.apache_php_fpmThe Apache PHP-FPM service.bindThe Berkeley Internet Name Domain (BIND) nameserver daemon.chkservdortailwatchcPanel & WHMs TailWatch log processing service.clamdThe ClamAV® antivirus daemon.cpanalysticsdThe cPanel Analytics daemon.cpanellogdThe cPanel log and bandwidth processor daemon.cpanel_ccsThe cPanel Calendar and Contacts server service.cpanel_dovecot_solrThe Apache Solr service.cpanel_php_fpmThe cPanel PHP-FPM service.cpdavdcPanel & WHMs WebDAV daemon.cpgreylistdcPanels Greylisting.cphulkdThe cPHulk service.cpipv6Binds or rebinds the servers IPv6 addresses.cpsrvdorcpanelThe cPanel server daemon.crondThe Cron daemon.Note:While Debian® systems (Ubuntu®) use the
crondaemon, you can usecrondas the service name when running the script.dnsadminThe cPanel Domain Name System (DNS) admin cache service.dovecotThe Dovecot mail server.eximThe Exim mail exchanger.ftpd,ftpd,ftpmagic, orftpserverThe configured FTP service (ProFTPD or Pure-FTPd).imap,pop, orpop3The Dovecot Internet Mail Access Protocol (IMAP) daemon.ipaliasesThe IP address aliasing software.lmtpThe Local Mail Transport Protocol (LMTP) service.mailmanThe Mailman service.mydnsThe MyDNS server.Important:We deprecated MyDNS in cPanel & WHM version 78. We strongly recommend that you use PowerDNS instead.
mysqlormysqldThe MySQL® service.namedThe BIND nameserver daemon.nscdThe Name Service Cache service.p0fThe passive OS fingerprinting service.pdnsorpowerdnsThe PowerDNS service.postgresorpostgresqlThe PostgreSQL® database service.proftpdThe ProFTP server daemon.pureftpdThe Pure-FTPd server daemon.queueprocdThe TaskQueue Processor daemon.rsyslogorrsyslogdThe system log service that monitors the web server and system activity.spamdThe Apache SpamAssassin daemon.sshdoropensshThe Secure Shell (SSH) daemon.tailwatchdorchkservdcPanels TailWatch log processing daemon.tomcatThe Apache Tomcat® service.
For more information about these services, read our cPanel & WHM Service Daemons documentation.
Example
To perform a hard restart for a service, use the restart and hard options. For example, to perform a hard restart for the named service:
/usr/local/cpanel/scripts/restartsrv_named --restart --hard

