2012-10-02 75 views
5

運行「頂」命令我有問題,使用的nohup來在後臺運行top命令。首先,我本地運行,爲使用「nohup的」在後臺

nohup top & 

它抱怨在nohup.out文本top: failed to get tty。我的最終目標是爲運行遠程機器上的頂部,像

nohup ssh -t [email protected] top & 

目前,上述命令也失敗

Pseudo-terminal will not be allocated because stdin is not a terminal.^M 
TERM environment variable not set 

任何想法?

PS:我從machineA運行此命令ping machineBmachineA永遠活着,但不併不總是登錄。

+3

您可以使用屏幕。它會打開一個終端,然後運行頂部,然後您可以分離(Ctrl + a然後d)退出,但讓屏幕在後臺運行。如果你不介意我問,你想達到什麼目的? –

+3

我很困惑_why_你想這樣做。 – tacaswell

+0

@JanitoVaqueiroFerreiraFilho我必須使用的nohup這是在我的Linux發行版內置,和我沒有root權限安裝''screen'' – Richard

回答

14

您是否嘗試過top命令的-b(批處理模式)開關?

+0

我會建議添加「最高命令」,只是爲了更清晰一點。 +1的答案雖然=) –

+0

你是偉大的:) – 2014-04-29 08:48:28

+0

它很好的工作......謝謝 – Mani