<HTML><BODY><br><br>Thank you for example. I write a simple plugin for template:<br><br>from twisted.application import service, internet<br>from twisted.internet import utils, reactor<br>from twisted.python import log<br>from twisted.python import usage<br><br>class Options(usage.Options):<br>&nbsp;&nbsp;&nbsp; pass<br><br>class TestService(service.Service):<br>&nbsp;&nbsp;&nbsp; name = 'TestService'<br><br>&nbsp;&nbsp;&nbsp; def __init__(self, reactor):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.reactor = reactor<br><br>&nbsp;&nbsp;&nbsp; def startService(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.reactor.callWhenRunning(self.Test)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.reactor.run()<br><br>&nbsp;&nbsp;&nbsp; def Test(self):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; utils.getProcessOutputAndValue('/usr/bin/sleep', args = ['1000'])<br><br><br>def makeService(options):<br>&nbsp;&nbsp;&nbsp; s = TestService(reactor)<br>&nbsp;&nbsp;&nbsp; return s<br><span></span><br>It's work (twistd -n test ) , but kill pid ( without kill -9 ) don't work. I see a message "Main loop terminated" and script continue running. Why ?<br><br><br><br><br>14 июля 2011, 17:30 от Duncan McGreggor &lt;duncan.mcgreggor@gmail.com&gt;:<br><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;" class="mailru-blockquote"><div id="class_1310657516">
<div class="js-helper">
        <style type="text/css"></style>
        <div id="style_13106502130000000918" class="pRel dB2 w100" style="overflow-x:auto;">
                <base href="http://e.mail.ru/cgi-bin/">
                
                        <div id="style_13106502130000000918_BODY">On Thu, Jul 14, 2011 at 7:05 AM, Thorne, Stephen &lt;<a href="sentmsg?compose&amp;To=stephen@thorne.id.au">stephen@thorne.id.au</a>&gt; wrote:<br>
&gt; On Thu, Jul 14, 2011 at 13:50, Ivan &lt;<a href="sentmsg?compose&amp;To=bdfy@mail.ru">bdfy@mail.ru</a>&gt; wrote:<br>
&gt;&gt; I have a very simple example:<br>
&gt;&gt;<br>
&gt;&gt; from twisted.internet import protocol, utils, reactor<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; def start():<br>
&gt;&gt; &nbsp;&nbsp;&nbsp; utils.getProcessOutputAndValue('sleep',['1000'])<br>
&gt;&gt;<br>
&gt;&gt; reactor.callWhenRunning(start)<br>
&gt;&gt; reactor.run()<br>
&gt;<br>
&gt; I put together an example of how to create a 'complete' example<br>
&gt; application using twisted plugins (which are also run with 'twistd'<br>
&gt; but allow things like command line arguments) a few weeks ago.<br>
&gt;<br>
&gt; repo is here: <a href="https://bitbucket.org/jerub/twisted-plugin-example&amp;msgid=13106502130000000918" target="_blank">https://bitbucket.org/jerub/twisted-plugin-example</a><br>
&gt;<br>
&gt; It shows how to do things in 'Service.startService', this approach<br>
&gt; would map to using a .tac file as well, with some munging.<br>
&gt;<br>
&gt; <a href="https://bitbucket.org/jerub/twisted-plugin-example/src/a3af1e55194a/examplepackage/examplemodule.py#cl-49&amp;msgid=13106502130000000918" target="_blank">https://bitbucket.org/jerub/twisted-plugin-example/src/a3af1e55194a/examplepackage/examplemodule.py#cl-49</a><br>
&gt;<br>
&gt; Stephen.<br>
<br>
I gotta second this. This is the best example of Twisted plugins I've<br>
seen yet. I know I'll regret saying this, but it's foolproof.<br>
<br>
d<br>
<br>
_______________________________________________<br>
Twisted-web mailing list<br>
<a href="sentmsg?compose&amp;To=Twisted%2dweb@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web&amp;msgid=13106502130000000918" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web</a><br>
</div>
                        
                
                <base href="http://e.mail.ru/cgi-bin/">
        </div>
</div>

</div></blockquote><br></BODY></HTML>