Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use "nohup" to run "top" command in background [closed]

I have problems in using nohup to run top command in the background. First, I run it locally, as

nohup top &

it complains in nohup.out with text top: failed to get tty. My ultimate goal is to run top on remote machine, like

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 machineB from machineA. machineA is always alive, but not not always logged in.

like image 698
Richard Avatar asked Oct 02 '12 18:10

Richard


1 Answers

Have you tried the -b (batch mode) switch of the top command?

like image 89
ggiroux Avatar answered Sep 21 '22 07:09

ggiroux