Creating a daemon
A common assignment when working with system programming is to create various daemons. A daemon is a background process that runs on the system and performs some tasks. The SSH daemon is a great example of this. Another great example is the NTP daemon, which takes care of synchronizing the computer clock and sometimes even distributing the time to other computers.
In this recipe, we will create a simple daemon to demonstrate some important concepts.
You'll only need the components listed in the Technical requirements section of this chapter.
How to do it…
In this recipe, we'll write a small daemon that will run in the background in our system. The only "work" the daemon will do is write the current date and time to a file. This proves that the daemon is alive and well. Let's get...