Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 08-31-2009, 05:44 AM   #1
Registered: Jul 2009
Posts: 50

Rep: Reputation: 16
Question How to create a console thread for a daemon ?

Hi All,

I have a C++ application which runs as a daemon and reads some configuration parameters from a configuration file at the very beginning of its execution.

The configuration file may be updated occasionally. However, I do not want to stop and then restart the daemon to adapt to the updated configuration file whenever it is changed - I want this adaptation to occur on the fly.

Hence, I want to create a separate thread for this daemon which will wait for a specific command such as "refresh" from the command line. When such a command entered, it will notify the daemon that the configuration file has just changed. Upon the notification, the daemon will read the configuration file again and adapt itself to the changes.

Where should I start to implement such an architecture ?

Is there any way other than using interprocess communication to implement this scenario ?

Old 08-31-2009, 04:04 PM   #2
LQ Newbie
Registered: Aug 2009
Location: Pittsboro, NC, USA
Distribution: Ubuntu
Posts: 7

Rep: Reputation: 1
You might want to check out something called "inotify" which is a kernel subsystem that will notify your program when a file gets modified.

-- Brett


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I create thread ? Jacky Quah Programming 12 11-10-2010 03:38 PM
daemon kernel thread amit_bst Linux - Kernel 3 04-28-2009 06:17 PM
How to create a DAEMON SlacUser Ubuntu 6 04-26-2007 06:08 PM
howto create daemon (service) under suse ? cccc SUSE / openSUSE 2 08-17-2006 05:53 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration