Save 15% on Instant Deploy Bare-Metal Servers in 26 Global Markets with Coupon Code: EdgeSave

Restart a service/daemon on a Linux cPanel dedicated server?




If you are running cPanel/WHM on a Linux dedicated hosting server, most of the services can be restarted from within WHM, however sometimes you will need to restart them from the shell via ssh. You must be logged in as root to do this.

All standard Linux services such as http, ftp, exim, cpanel/whm, interchange, mysql, etc have init scripts in /etc/init.d/

To see what services with init scripts are on your dedicated server just type:

ls /etc//init.d/

There should be quite a few listed there.

The init scripts that you should be concerned with are:

  • cpanel3 – starts & stops cPanel and WHM. This includes Interchange, cppop, and cluster management services as well.
  • exim – starts & stops the exim mail server.
  • httpd – starts & stops the apache webserver.
  • mysql – starts & stops the MySQL database server.
  • named – starts & stops the BIND dns server.
  • proftpd – starts & stops the ProFTPD (or pureftpd when that is enabled) ftp server.

Using these scripts is very easy. Lets say that named/bind is down and you need to restart it. As root, simply type:

/etc/rc.d/init.d/named start

You should see it start up with a green [OK] on the left side of the terminal window. If you see a red [FAILED], check the message log:

tail /var/log/messages

You should be able to see the error where things went wrong. If you cna not fix this yourself, please contact technical support and we will take a look.

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.


Share on Twitter
Share on Facebook