Application development : method to manage backgound process

Posted by Simon Dubois on Ask Ubuntu See other posts from Ask Ubuntu or by Simon Dubois
Published on 2012-09-11T09:12:55Z Indexed on 2012/09/11 9:50 UTC
Read the original article Hit count: 240

I am developing an application with different behavior depending on the arguments :
- "-config" starts a Gtk window to change options, start and close the daemon.
- "-daemon" starts a background process that does something every X minutes.

I already know how to use fork/system/exec etc...
But I would like to know the main logic of such application to :
- restart or refresh the daemon when configuration change.
- keep only one instance of the daemon.

I have red that killing the daemon to restart it is not a clean way to do.
How other applications do ? (ubuntuone, weather forecast, rss feed working with notification area)

Thanks for your help.

PS : I don't want to create a system-wide daemon, just a user application with a background process.

© Ask Ubuntu or respective owner

Related posts about application-development

Related posts about c++