BuycPanel Blog

BuycPanel Blog

Latest news and updates

3/11/2015 – How to Restart Daemon

Posted by Jamison on 11 03 2015.

Essentially, a daemon is a constantly-running script in the background that performs a set action as frequently as you set it.

 

Examples of daemons are:

 

  • Running a CD or DVD image loader while you play a game or run a program.
  • System maintenance tasks run on your cPanel or website every year, month, week or day.
  • Auto email of logs for the past day, week, month or year regularly.

 

cPanel makes it extremely easy for you to modify your daemons thanks to it convenient and user-friendly interface. You may want to restart a daemon because you want it to run the instance again or to modify its settings after you’ve tweaked it on the UI.

 

You can restart most services in WHM’s Restart Services interface (Home >> Restart Services).

 

Sometimes, you may need to get into the command console so you can make sure that cPanel has restarted the daemon.

 

Before anything else, though, keep the following in mind:

 

  • You must log in as the root user to restart a daemon.
  • All standard Linux services, such as HTTP, FTP, Exim, cPanel & WHM, MySQL, etc, have init scripts in the /etc/rc.d/init.d/ directory.

 

The following example is typical of the contents that you will find in the /etc/rc.d/init.d/ directory:

 

1

2

3

4

5

6

7

root@host [~]# ls /etc/rc.d/init.d/

./ atd* exim* httpd.tmpeditlib kdcrotate* named* nscd* rawdevices* snmpd* yppasswdd*

../ autofs* filelimits* identd* keytable* netfs* portmap* rstatd* sshd* ypserv*

anacron* bandmin* functions* ipaliases* killall* network* portsentry* rusersd* syslog* ypxfrd*

antirelayd* chkservd* gpm* ipchains* kudzu* nfs* proftpd* rwalld* xfs*

apmd* cpanel3* halt* iptables* lpd* nfslock* radvd* rwhod* xinetd*

arpwatch* crond* httpd@ isdn* mysql* nofsck* random* single* ypbind*

 

Take note of the following files:

 

  • cpanel — This file starts and stops cPanel & WHM. This also includes cppop and DNS cluster management services.
  • exim — This file starts and stops the Exim mail server.
  • httpd — This file starts and stops the Apache web server.
  • mysql — This file starts and stops the MySQL® database server.
  • named — This file starts and stops the BIND DNS server.
  • proftpd — This file starts and stops the ProFTPd or Pure-FTPd FTP server, based on which service is enabled.

 

Run these files as scripts to restart a daemon. For example, if you need to restart the named (BIND) daemon, run the following command as the root user:

 

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

 

You should see the script start up, with a green [OK] message on the left side of the terminal window. If you see a red [FAILED] message, run the following command to check the /var/log/messages file:

 

tail /var/log/messages

 

The error message will display. If you cannot fix it yourself, submit a ticket to cPanel and the support team will get back to you immediately. Some of these services have many options. For example, if you have several domains that are on your DNS server and you do not want to stop and restart the named daemon because you edited one domain, run the following command:

 

rndc reload

 

If you make a minor change to the /usr/local/apache/conf/httpd.conf file, but do not want to restart it, run the following command to perform a graceful restart:

 

/etc/rc.d/init.d/httpd graceful

 

It’s important to remember that a graceful restart finishes current requests before it kills the child processes.