In this article I will present to you some useful functions for handling the PID file of a background daemon. Most of the background daemons maintain a PID file usually in a well-known path such as the “/var/run”. For example, the GNOME Display Manager which runs as a background daemon (gdm3) maintains the following file “/var/run/gdm3.pid”. A PID file contains the PID number of the daemon process currently running. This information is useful either for validation or for sending various signals to the daemon process. Also, if a background daemon must have a single running instance this can be accomplished by checking if the PID number of the PID file really exists in the system.
Tag Archive: daemon
Implementation of a C function to convert a typical process into a background service (Daemon) – Version 2.
In a previous article I had shown to you how a typical process in GNU/Linux operating systems can be converted to a background daemon process. The source code from the previous article was taken from an old project I wrote years ago. Nowadays, I have rewritten the daemonizing function in a new project and I think it could be nice to share it. I have simplified the function and now it has a clearer and simpler API.
The project ‘gtrm’ (GNU Terminal Random Message).
It is true that Software Programming is a branch of Computer Science about which I’m pretty enthusiastic. But I’m very excited at the times when I learn something new and innovative on programming. Such a period of learning of new issues on programming was when I began to wonder about the way the Internet works. My questions were related to the client – server architecture model (on whose base the Internet and its services has been designed), how web applications is in practice implemented and how I could implement an Internet service on my own.
This project refers to a sketch (an Arduino program) in which you have the ability to run applications with the help of an infrared receiver (IR) and a remote control. Also included in this project is a Python script that implements a background service (Daemon) which communicates with the Arduino and initiates the execution of various applications. The program can manage several remote controls following the communication protocols NEC, Sony SIRC, Philips RC5 and Philips RC6. Also, you are given the opportunity to train the software to respond to specific keys from several remotes (the knowledge is recorded in the EEPROM of the Arduino).
Arduino: Executing applications with voice command recognition.
This project refers to an Arduino sketch which with the help of a VRBot system can recognize voice commands, making it possible to run applications. For example, we could cause the execution of the relevant browser with the voice command «Firefox». Also included in this project is a Python script that implements a background service (Daemon) which communicates with the Arduino and initiates the execution of various applications.
Implementation of a C function to convert a typical process into a background service (Daemon) – Version 1.
Below I quote a function in C to convert a standard Linux kernel process into background service (Daemon Service). If you wish to develop a server to provide services, it may be helpful. Although there are several manuals on the Internet on how to create background services, most of them don’t show a complete example, while others are barely functioning. The following function converts a standard process into a service taking everything you need into account. Also, this function is the result of a combination of several textbooks and numerous studies about this issue. Finally, it has been tested on personal applications servers and it is performing well.