posts - 13,  comments - 4,  trackbacks - 0
Linux系统中top命令是交互式命令,故脚本中执行时会卡住,不再执行下一个命令。
解决办法是:top -n 1。
程序调用top命令时常会报
top: failed tty get 错误,此时使用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.
-n : Number of iterations limit as:  -n number
            Specifies the maximum number of iterations, or frames, top should produce before ending.
posted on 2011-12-06 15:39 身在半空 阅读(2545) 评论(1)  编辑  收藏

FeedBack:
# re: linux脚本执行top命令
2014-09-10 10:07 | 繁体字
嗯,不错!  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 

<2014年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿

随笔档案

文章档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜