Hi All,<br><br>A day back I install Twisted and Conch on RHEL5. I am a novice user of Twisted software.<br>I copied an example from dev-shed website (attached herewith). This example script uses conch to talk to a ssh deamon.<br>
<br>This script was able to capture and return the output of simple commands such as - ls, cat etc.<br>I mean, when I run the script to execute 'ls -al' on a remote machine it does and returns the prompt.<br><br>Where as, when I run the script to execute '<b>tail -f /path/to/mylog.txt</b>' I get the ouput of this command but the prompt never returns.<br>
When I press ^C (Control-C) I get the following run-time error.<br><br><i>Traceback (most recent call last):<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/internet/tcp.py", line 520, in connectionLost<br>
protocol.connectionLost(reason)<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/conch/ssh/transport.py", line 166, in connectionLost<br> self.service.serviceStopped()<br>
File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/conch/ssh/connection.py", line 59, in serviceStopped<br> map(self.channelClosed, self.channels.values())<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/conch/ssh/connection.py", line 580, in channelClosed<br>
log.callWithLogger(channel, channel.closed)<br>--- <exception caught here> ---<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/python/log.py", line 84, in callWithLogger<br>
return callWithContext({"system": lp}, func, *args, **kw)<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/python/log.py", line 69, in callWithContext<br> return context.call({ILogContext: newCtx}, func, *args, **kw)<br>
File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/python/context.py", line 59, in callWithContext<br> return self.currentContext().callWithContext(ctx, func, *args, **kw)<br>
File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/python/context.py", line 37, in callWithContext<br> return func(*args,**kw)<br> File "shankha.py", line 56, in closed<br>
reactor.stop()<br> File "/usr/lib/python2.4/site-packages/Twisted-8.2.0-py2.4-linux-i686.egg/twisted/internet/base.py", line 526, in stop<br> raise error.ReactorNotRunning(<br>twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.</i><br>
<br><br><b>I know that 'tail -f' command is expecting "Control-C" or Break to return the prompt on remote host. <br>But my attempt to send the ^C character is failing.. <br><br>I am doing somethink like this:<br>
<br>python sshc.py <hostname> 'tail -f mylog.txt ; \x03'<br><br>What is the recommended method to adopt such cases?<br><br></b>Cheers!!<br>Harsha Reddy<br>