标签: curses

如何直接在控制台中启动 qemu(*不是*在curses或SDL中)

我似乎记得能够仅使用终端仿真器输出启动 qemu,同时禁用图形窗口。在这里我不是说 ncurses 界面,那个界面很好,但我希望输出直接流入我的终端,使剪切和粘贴更容易。

我试过了:

qemu -nographic binary.img # simply no display
qemu -curses binary.img # nice text output, but not directly flowing in the terminal
qemu -noframe -curses binary.img # same as above
qemu -nographic -curses binary.img
Run Code Online (Sandbox Code Playgroud)

我想一个可以接受的解决方法是让我能够调整 curses 控制台的大小以适应我正在使用的终端。现在很烦人,因为它不适合终端尺寸......

qemu -curses  binary.img



           SeaBIOS (version 1.7.0-20120603_194846-gandalf)



           iPXE (http://ipxe.org) 00:03.0 C900 PCI2.10 PnP PMM+07FC86A0+07F886A0 C900


           Booting from Hard Disk...
           [...]
Run Code Online (Sandbox Code Playgroud)

注意显示是如何缩进 12 个空格的?恼人的。:)

terminal display serial qemu curses

26
推荐指数
2
解决办法
7万
查看次数

顶部输出在 cron 中缩小

我正在尝试通过 cron 发送电子邮件以了解哪些进程占用了我的服务器。它工作正常,但生成的电子邮件太窄,我需要了解更多有关该过程的信息。

这是我正在使用的脚本(从这里偷来的:http : //www.inmotionhosting.com/support/website/server-usage/create-server-load-monitoring-bash-script):

#!/bin/bash
trigger=10.00
load=`cat /proc/loadavg | awk '{print $1}'`
response=`echo | awk -v T=$trigger -v L=$load 'BEGIN{if ( L > T){ print "greater"}}'`

if [[ $response = "greater" ]]
then
top -cSbn 1 | head -14 | tail -8 | mail -s"High load on server - [ $load ]" myemail@domain.com
fi
Run Code Online (Sandbox Code Playgroud)

生成的电子邮件类似于:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND

 810809 root      20   0 20700  13m 3032 R   50 …
Run Code Online (Sandbox Code Playgroud)

email bash curses

4
推荐指数
1
解决办法
352
查看次数

通过 SSH 远程运行一次性交互式程序

我有一系列生产服务器,我希望能够在这些服务器上运行某些实用程序,而无需通过 SSH 连接到机器。

不幸的是,其中一些程序(我到目前为止尝试过的 top 和 iotop)需要设置 Curses 和/或 TERM 环境变量,并且通过 SSH 从 shell 执行不起作用:

$ ssh myserver top
TERM environment variable not set.
$ ssh myserver iotop
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 16, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 571, in main
    main_loop()
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 561, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python2.7/dist-packages/iotop/ui.py", line 465, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib/python2.7/curses/wrapper.py", line 22, in wrapper
    stdscr = curses.initscr()
  File "/usr/lib/python2.7/curses/__init__.py", line 33, in …
Run Code Online (Sandbox Code Playgroud)

remote-access ssh terminal curses

1
推荐指数
1
解决办法
957
查看次数

标签 统计

curses ×3

terminal ×2

bash ×1

display ×1

email ×1

qemu ×1

remote-access ×1

serial ×1

ssh ×1