<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 27 February 2013 11:03, Chris Angelico <span dir="ltr"><<a href="mailto:rosuav@gmail.com" target="_blank">rosuav@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On Wed, Feb 27, 2013 at 9:52 PM, Gilles Lenfant<br>
<<a href="mailto:gilles.lenfant@gmail.com">gilles.lenfant@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> Sorry for the obscure title, but I can't make short to explain what I'm searching for. :)<br>
><br>
> I made an app (kind of proxy) that works without UI within it's process. So far, so good.<br>
><br>
> Now I need to change "live" some controls of this application, without stopping it.<br>
><br>
> So my app will be split in two :<br>
><br>
> * A control app (say "appctl") for a console UI<br>
> * A daemon (or agent ?) that runs the core of the app (say "appd"), processing inputs and outputs<br>
<br>
</div>Daemonizing is a fairly specific operation (forking and disconnecting<br>
from the console), which may well be a part of what you're asking for,<br>
but on the other hand may be unnecessary (if, for instance, you let<br>
your core app be invoked by Upstart directly).<br>
<br>
What form of control do you need? With many apps of this nature, the<br>
only control required is Unix signals - particularly SIGHUP, to say<br>
"I've edited your config files, go reread them". Your front end might<br>
do the editing, or you could even abolish the control app altogether<br>
and simply edit the configs manually. But if you need more, you'll<br>
need to work out how you want them to communicate with each other.<br>
<br>
What platform or platforms do you need this to run on?<br>
<br>
Regardless of your answers to the above, I would say that in all<br>
probability *yes*, you will be able to do this with just Python and<br>
the standard library. There are a lot of batteries included with<br>
Python :)<span class=""><font color="#888888"><br>
</font></span></blockquote></div><br>One solution is to use XMLRPC to communicate with the daemonized 
process. This does involve the daemon listening on the local network. 
The GUI can then connect to the daemon and send it commands which 
essentially is calling functions on the daemon. These can then change 
certain behaviors of the daemon process without restarting it. If you 
want to be hardcore you can use sockets. There are other networking libs
 like Twisted and RabbitMQ, but they might be a bit overkill for your 
purpose.<br>
<br>But whether any of this is ok depends on your use case. The signals 
Chris mentioned will also work. Alternatively there are a number of 
filewatching libraries like watchdog or <a href="https://github.com/seb-m/pyinotify" target="_blank">https://github.com/seb-m/pyinotify</a> which you can use to monitor changes to a config file if that's the way you want to go.<br clear="all">
<br>-- <br>./Sven
</div></div>