ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Oh, I think I get it now. You want to know whether a prior instance of the daemon was already running? Lock files are commonly used for this purpose. No matter what scheme you use, the tricky part is making sure the 'flag', of what ever sort you use, always gets cleared when the daemon exits. If it doesn't, any subsequent attempt to restart the process will fail.
In the your case, the mere presence of the entity is enough to indicate that an instance of the daemon already exists. The entity can be a file, a message queue, shared memory segment, or anything else that can be created and mutually located by arbitrary processes.