|paramiko exec_command timeout|
I have a paramiko program which sshs to a large number of machines, and sometimes it hits a machine where Channel.exec_command() doesn't return. I know this is a problem with the remote machine, because the same thing happens when I try to ssh to the machine from the command line. However, I don't have any way of determining which machines are broken beforehand.
Paramiko doesn't support a timeout for exec_command(), so I am looking for a generic way of running a function call with a timeout. I can see sample code which does this using threads, but that's pretty ugly. I can't use SIGALARM because I am not running on the main thread.
Can anyone think of a better way of doing this?
Tags for this post: python paramiko exec_command timeout
Related posts: Executing a command with paramiko; Calculating a SSH host key with paramiko; Implementing SCP with paramiko; Multiple file support with scp; Weird paramiko problem; Universal Feedparser and XML namespaces
posted at: 12:20 | path: /python/paramiko | permanent link to this entry