bash 使用“nohup”在后台运行“top”命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12695770/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Use "nohup" to run "top" command in background
提问by Richard
I have problems in using nohup to run top command in the background. First, I run it locally, as
我在使用 nohup 在后台运行 top 命令时遇到问题。首先,我在本地运行它,作为
nohup top &
it complains in nohup.outwith text top: failed to get tty. My ultimate goal is to run top on remote machine, like
它nohup.out用 text抱怨top: failed to get tty。我的最终目标是在远程机器上运行 top,比如
nohup ssh -t user@hostname top &
currently, the above command also fails with
目前,上述命令也失败了
Pseudo-terminal will not be allocated because stdin is not a terminal.^M
TERM environment variable not set
Any ideas?
有任何想法吗?
PS: I run this command to ping machineBfrom machineA. machineAis always alive, but not not always logged in.
PS:我运行此命令pingmachineB从machineA。machineA总是活着,但并不总是登录。
回答by ggiroux
Have you tried the -b (batch mode) switch of the top command?
您是否尝试过 top 命令的 -b(批处理模式)开关?

