If you are running cPanel/WHM on a Linux dedicated server, most of the services can be restarted from within WHM, however sometimes you will need to restart them from the shell via ssh. To do this, you must be logged in as root.
All standard Linux services such as http, ftp, exim, cPanel/WHM, interchange, mySQL, etc have init scripts in /usr/local/cpanel/bin and /usr/local/cpanel/scripts.
To see what services with scripts are on your dedicated server, just type:
ls /usr/local/cpanel/bin
ls /usr/local/cpanel/scripts
The scripts that you should be concerned with are:
- restartsrv_cpsrvd – this starts & stops cPanel and WHM. This includes Interchange, cppop, and cluster management services as well.
- restartsrv_exim – starts & stops the exim mail server.
- restartsrv_httpd – starts & stops the apache webserver.
- restartsrv_mysql – starts & stops the MySQL database server.
- restartsrv_named – starts & stops the BIND dns server.
- restartsrv_proftpd – starts & stops the ProFTPD (or pureftpd when that is enabled) ftp server.
Using these scripts is easy. Let’s say that named/bind is down and you need to restart it. As root, simply type:
/usr/local/cpanel/scripts/restartsrv_named
Some of these services have more options than just start and stop and other ways to use them. If you have a lot of domains using your DNS server and you don’t want to stop and restart it because you edited one domain, type “ndc reload”. ndc controls the named daemon. If you make a minor change to /usr/local/apache/conf/httpd.conf, but do not want to restart it, type “/etc/rc.d/init.d/httpd graceful” to do a graceful restart (this will finish current requests before killing the child processes).
If you want to learn more about what commands each script offers, you can simply run the script without passing any arguments to it:
root@server [~]# /etc/rc.d/init.d/cpanel3
Usage: /etc/rc.d/init.d/cpanel3 {start|stop|status|restart}
This lets you know that you can start, stop, check the running status of the service(s) or restart it.