While many know daemons from Greek mythology, we will learn what a daemon is in the world of software. If you ever manually installed software or a service on your server, a daemon runs in the background. This article will discuss what daemons are, the difference between a daemon and a process, the most common daemons, and how to use daemons on CentOS 6 and CentOS 7.
Daemon Meaning
A daemon is a program that runs continuously in the background of a multitasking operating system, meaning that daemons are not under the user’s direct control. A specific action or event activates daemons. Most daemon file names end with the letter d.
While scripts like init or systemd start most daemons when a system boots up, some start manually. Examples of manually triggered daemons are:
- mysqld: Database server
- httpd: Web server
Daemon vs Process
As explained above, a daemon is a non-interactive program. It runs all the time, and it’s not connected to the terminal. Even when you close the terminal, the operating system will not stop the daemon as it will run in the background.
On the other hand, a process will stop when the terminal closes because it is an executing program instance.
Most Common Daemons
| Daemon | Description |
|---|---|
| crond | Cron Daemon. Job scheduler that will trigger a specific action at a scheduled time. |
| sshd | OpenSSH Daemon. Listens to secure shell protocol and processes incoming requests. |
| httpd | Listens to the incoming requests sent to the web server and answers. |
| mysqld | Stops and starts a database server. |
| sendmail | SMTP or Mailer Daemon. Controls the automatization of emails, like the message returned when an email bounces. |
Using Daemons
There are three simple commands used in most cases when interacting with Daemons, but they are different depending on your CentOS version.
CentOS 7 and Above
If using CentOS 7 and above, use systemctl in your commands.
Starting the daemon.
systemctl start httpdStopping the daemon.
systemctl stop httpdCreate a symlink to automatically start the daemon on every boot.
systemctl enable httpdCentOS 6 or Below
When using CentOS 6 or below, replace systemctl with service and flip where httpd appears in the command.
Starting the daemon.
service httpd startStopping the daemon.
service httpd stop[su_box title=”Caution:” style=”glass” box_color=”#3ac6eb” radius=”20″]The init script does not support creating a symlink by using service httpd enable. To automatically start a daemon on CentOS 6 or below, manually create the symlink.[/su_box]
Conclusion
We hope this article has helped you understand what a daemon is and how it works. Make sure to double-check your CentOS version before interacting with daemons.
Learn more about the hosting solutions at Liquid Web, ranging from managed WordPress to VPS hosting to GPU server hosting, that fit any project, big or small.
Dean Conally