<div dir="ltr">Hi,<br><br>I have a very similar question to the one that Vye Wilson<br>recently asked, &quot;Subject: What is The Correct Way to Close a Twisted Conch SSH Connection?&quot;<br><br>I am using Twisted Conch to write a program that<br>
ssh&#39;s into multiple machines and executes a single command.<br><br>I am basically trying to do the equivalent of:<br><br>for host in host1 host2 host3<br>do<br>     ssh  user@host &quot;cat /etc/hosts&quot;<br>done<br>
<br><br>To start things off, I took <a href="http://twistedmatrix.com/documents/current/conch/examples/sshsimpleclient.py">http://twistedmatrix.com/documents/current/conch/examples/sshsimpleclient.py</a><br>and started modifying it.  Here is the code which I have:<br>
<br><a href="http://pastebin.com/RXhjUcrS">http://pastebin.com/RXhjUcrS</a><br><br>The problem is, I can&#39;t figure out how to tell when a command has<br>completed, so that I can call reactor.stop().<br><br>Not in the code example I posted above, I tried to use a DeferredList by following the example code in this blog<br>
post:<br><br><a href="http://technicae.cogitat.io/2008/06/async-batching-with-twisted-walkthrough.html">http://technicae.cogitat.io/2008/06/async-batching-with-twisted-walkthrough.html</a><br><br>but I ran into the same problem where I couldn&#39;t figure out how<br>
to tell when my command over SSH had terminated.<br><br>As a kluge, I called reactor.callLater() with a timeout of<br>20 seconds, and then called reactor.stop().<br><br>Any ideas as to what I am doing wrong?<br>Where in the Conch framework can I tell when a command<br>
over SSH has finished?<br><br>Thanks.<br><br>--<br>Craig Rodrigues<br><a href="mailto:rodrigc@crodrigues.org">rodrigc@crodrigues.org</a><br><br><br>
</div>