【发布时间】:2016-05-25 23:44:26
【问题描述】:
我得到了以下 ssh 命令,
try:
print 'trying to restart'
self.ssh.exec_command(RR_CMD % (self.path_ext, self.rport), timeout=1)
print 'restarted'
except:
self.ssh.close()
self.ssh = ssh.create_ssh_client(self.ip, self.port, self. username, self.password)
self.restart()
基本上我正在尝试重新启动远程 perl 脚本。 但有时,比如假设 2000 年中有 1 次 - 我的 python 程序在 exec_command 行上冻结有时长达几分钟!
我想使用超时功能,我设置为 1 秒,但由于某种原因它不起作用。
【问题讨论】: