top后台执行显示:top: failed tty get 错误

通过其他程序或脚本在非交互式模式下调用top命令,经常会出现:
   top: failed tty get 错误

解决办法:加个-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 youve set with the -n command-line option or until killed.

例如执行:top -bn 1

内容版权声明:除非注明,否则皆为本站原创文章。

评论