美文网首页
python使用paramiko执行top命令报错

python使用paramiko执行top命令报错

作者: 鱼豆腐爱好者协会会长 | 来源:发表于2019-11-14 17:28 被阅读0次

出错脚本:

ssh.exec_command('top -n 1')

报错信息如下:
TERM environment variable not set

man top 中的 -b 选项的说明信息:

-b :Batch-mode operation

            Starts  top  in Batch mode, which could be useful for sending output from top to other programs or to a file.  In this mode, top will not accept input and runs until the iterations limit you've set with the `-n' command-line option or until killed.

不报错脚本:

ssh.exec_command('top -b -i -n 1')

相关文章

网友评论

      本文标题:python使用paramiko执行top命令报错

      本文链接:https://www.haomeiwen.com/subject/fdfrictx.html