A simpler definition for daemons is that a daemon is a program that runs unattended even if no one is logged into your system. A more common daemon has a syslog daemon that collects system error information and writes it to a log file; There are also Apache or httpd daemons used to provide Internet browsers with the pages you need to browse and the SendMail daemon to push the email received by the server to your Inbox.
Startup scripts located in the/ETC/INIT.D directory manage the active state of the daemons that are installed with the Linux package, and the start and stop commands are common to all these scripts.
Start daemon
If a startup script exists in the/ETC/INIT.D directory, its daemon will start by specifying its filename and then adding the keyword "start", as shown here:
root@u-bigboy:~#/etc/init.d/apache Start * Starting Apache 1.3 Web server ... done.root@u-bigboy:~#
Stop Daemon
The daemon can stop by specifying its filename and then adding the keyword "Stop" in the following way;
root@u-bigboy:~#/etc/init.d/apache Stop * Stopping Apache 1.3 Web server ... done.root@u-bigboy:~#
Reboot Daemon
Typically, the daemon only reads the appropriate configuration file at startup, so if you overwrite its profile, you will have to restart the daemon in order for it to take effect. A command with the keyword "Restart" will help you implement the reboot operation:
root@u-bigboy:~#/etc/init.d/apache Restart * Restarting Apache 1.3 Web server ... done.root@u-bigboy:~#
Don't worry about configuring your daemon. We'll look at some of the commonly used daemons later and take a few simple examples to learn more about them.
About service Commands
Some operating systems such as Fedora and Rathat also have quick service commands that allow you to control daemons using "Start", "Stop" and "restart", but use fewer characters. Here are some quick, intuitive examples of how to implement this feature:
[Root@bigboy ~]# service httpd start[root@bigboy ~]# service httpd stop[root@bigboy ~]# service httpd restart
The service command also has the "status" keyword, which is used to provide a concise report on the current work of the daemon.
[Root@bigboy ~]# service httpd statushttpd (PID 6135 6133 6132 6131 6130 6129 6128 6127) is 1561 ... [Root@bigboy ~]#