LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to make TCP server a daemon / service much like a dhcpd service? (https://www.linuxquestions.org/questions/linux-networking-3/how-to-make-tcp-server-a-daemon-service-much-like-a-dhcpd-service-555714/)

rajat 05-22-2007 12:32 AM

How to make TCP server a daemon / service much like a dhcpd service?
 
Hi Folks !
I have a fedora core 6 machine, kernel 2.6.18. I intend to create my TCP Server a daemon ( or a service) much like any other daemon / service like dhcpd.

Is this possible?
I want it to be able to control much like a dhcpd service is controlled ie. I should be able to start, stop and query its status as we do it with the dhcpd service.

I know i'm mixing up the 2 terms daemon and service. But I do not have any idea as to whether they are the same or different.

Please suggest how should I go about doing this. At the least I request to please direct me to some link on the net.


Thanks and regards,
Rajat

raskin 05-22-2007 01:29 AM

http://en.wikipedia.org/wiki/Daemon_(computer_software) - as for links for daemon, and description of what it is. But daemon only refers to mode of running of one instance of process; there is sometimes 'daemon' utility that can run any process not requiring input/output to console as daemon.

What you want about controlling it like other system daemons, is achieved by initscripts. Look at /etc/init.d/dhcpd (or /etc/rc.d/init.d/dhcpd, it varies). It is a shell script, that can take 'start', 'stop' and 'restart' parameters (sometimes such scripts can take some other parameters, like 'reload', but are only run with a single parameter). It then loads parameters from configuration files in /etc, decides what command-line is needed for daemon and either runs it ('start') or makes it know it needs to terminate ('stop'), usually by sending a signal that daemon will proceed (read man signal) or - if it is 15 (SIGTERM), for example - which will make OS terminate daemon.


All times are GMT -5. The time now is 03:38 PM.